Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.20.2] Collapse TextureStitchEvent into a single post-stitch event #208

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
sciwhiz12 marked this conversation as resolved.
Show resolved Hide resolved
*
* @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.