Container event spam when no container is open fixed. Fixed scripted player and forge events not launching after merging ScriptContainer and EventScriptContainer.

This commit is contained in:
luisc committed 2021-12-03 18:17:52 -06:00
1 parent 23686dc3b8
commit 547f5ab82d
4 files changed
+41 -65

No files matched your search

@@ -28,6 +28,7 @@ import cpw.mods.fml.common.network.FMLNetworkEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
@@ -173,7 +174,7 @@ public class ScriptPlayerEventHandler {
@SubscribeEvent
public void invoke(PlayerOpenContainerEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
if(event.entityPlayer.worldObj instanceof WorldServer && !(event.entityPlayer.openContainer instanceof ContainerPlayer)) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerContainerOpen(handler, event.entityPlayer.openContainer);
}