Skip to content

Commit

Permalink
maybe fix event listener? I think?
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Dec 7, 2024
1 parent 021be67 commit 0a6d78e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
import net.minecraft.client.gui.screens.inventory.MenuAccess;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.common.MinecraftForge;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.AllArgsConstructor;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
Expand Down Expand Up @@ -65,6 +66,7 @@ public void execute(IHandlerContext handler) {
}
}

@AllArgsConstructor
public static class SyncPropertiesPacket implements IPacket {

public FriendlyByteBuf payload;
Expand Down Expand Up @@ -98,13 +100,14 @@ public void execute(IHandlerContext handler) {
}
}

@OnlyIn(Dist.CLIENT)
@Mod.EventBusSubscriber(modid = GTCEu.MOD_ID, value = Dist.CLIENT)
public static class Client {

public static void init() {
MinecraftForge.EVENT_BUS.addListener(ScreenInternals.Client::afterScreenOpened);
}

@SubscribeEvent
private static void afterScreenOpened(ScreenEvent.Opening event) {
if (event.getNewScreen() instanceof MenuAccess<?> handled) {
((UIAbstractContainerMenuExtension) handled.getMenu())
Expand Down

0 comments on commit 0a6d78e

Please sign in to comment.