Skip to content

Commit

Permalink
Collapse TextureStitchEvent into a single post-stitch event (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
XFactHD authored Oct 31, 2023
1 parent e425cf7 commit 3594d1f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
this.animatedTextures = List.copyOf(list1);
}
+
+ net.neoforged.neoforge.client.ClientHooks.onTextureStitchedPost(this);
+ net.neoforged.neoforge.client.ClientHooks.onTextureAtlasStitched(this);
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/neoforged/neoforge/client/ClientHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
import net.neoforged.neoforge.client.event.RenderTooltipEvent;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.client.event.ScreenshotEvent;
import net.neoforged.neoforge.client.event.TextureStitchEvent;
import net.neoforged.neoforge.client.event.TextureAtlasStitchedEvent;
import net.neoforged.neoforge.client.event.ToastAddEvent;
import net.neoforged.neoforge.client.event.ViewportEvent;
import net.neoforged.neoforge.client.event.sound.PlaySoundEvent;
Expand Down Expand Up @@ -283,8 +283,8 @@ public static boolean renderSpecificFirstPersonArm(PoseStack poseStack, MultiBuf
return NeoForge.EVENT_BUS.post(new RenderArmEvent(poseStack, multiBufferSource, packedLight, player, arm)).isCanceled();
}

public static void onTextureStitchedPost(TextureAtlas map) {
ModLoader.get().postEvent(new TextureStitchEvent.Post(map));
public static void onTextureAtlasStitched(TextureAtlas atlas) {
ModLoader.get().postEvent(new TextureAtlasStitchedEvent(atlas));
}

public static void onBlockColorsInit(BlockColors blockColors) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) NeoForged and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/

package net.neoforged.neoforge.client.event;

import net.minecraft.client.renderer.texture.TextureAtlas;
import net.neoforged.bus.api.Event;
import net.neoforged.bus.api.ICancellableEvent;
import net.neoforged.fml.LogicalSide;
import net.neoforged.fml.event.IModBusEvent;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import org.jetbrains.annotations.ApiStatus;

/**
* Fired <b>after</b> a texture atlas is stitched together and all textures therein have been loaded.
*
* <p>This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.</p>
*
* <p>This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus()} mod-specific event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*
* @see TextureAtlas
*/
public class TextureAtlasStitchedEvent extends Event implements IModBusEvent {
private final TextureAtlas atlas;

@ApiStatus.Internal
public TextureAtlasStitchedEvent(TextureAtlas atlas) {
this.atlas = atlas;
}

/**
* {@return the texture atlas}
*/
public TextureAtlas getAtlas() {
return atlas;
}
}

This file was deleted.

0 comments on commit 3594d1f

Please sign in to comment.