DoubleDoorDevelopment / ItemBlacklist

Now is not the time to use that. (Dimension based item filter)
MIT License
7 stars 5 forks source link

Incompatible with some techguns items: Client Crash #36

Open TheSorrowX opened 4 years ago

TheSorrowX commented 4 years ago

Client gets locked up and crashes when banning techgun Items. in particular, jetpacks. if the techguns jetpack is in the regular minecraft inventory it will lock fine, however if the jetpack is being worn in the techguns inventory the game crashes

java.lang.ClassCastException: net.doubledoordev.itemblacklist.util.ItemBlacklisted cannot be cast to techguns.api.tginventory.ITGSpecialSlot at techguns.items.armors.GenericArmor.getBonusForSlot(GenericArmor.java:341) at techguns.items.armors.GenericArmor.getArmorBonusForPlayer(GenericArmor.java:331) at techguns.events.TGTickHandler.onPlayerTick(TGTickHandler.java:301) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_480_TGTickHandler_onPlayerTick_PlayerTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPostTick(FMLCommonHandler.java:370) at net.minecraft.entity.player.EntityPlayer.func_184808_cD(EntityPlayer.java:378) at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:288) at net.minecraft.client.entity.EntityPlayerSP.func_70071_h_(EntityPlayerSP.java:181) at micdoodle8.mods.galacticraft.core.entities.player.GCEntityClientPlayerMP.func_70071_h_(GCEntityClientPlayerMP.java:388) at net.minecraft.world.World.func_72866_a(World.java:1996) at net.minecraft.world.World.func_72870_g(World.java:1958) at net.minecraft.world.World.func_72939_s(World.java:1762) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1847) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1098) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Claycorp commented 4 years ago

Looked at there code quick as I didn't understand why this would ever happen from the crash. Now I get why... I assume they use some sort of limited slot as in you can't put anything but specific items but that doesn't stop the data for that slot from being changed outside of there control. They really shouldn't be assuming that there item will always be in that slot.

https://github.com/pWn3d1337/Techguns2/blob/4e26523cb0556ad56fefbee83c4df3fe94a426be/src/main/java/techguns/items/armors/GenericArmor.java#L340-L341

They don't check that the item there is valid before trying to cast it.

TechGuns needs to fix this, I'm not adding special cases. I'll leave this issue open till it's fixed.

TheSorrowX commented 4 years ago

Yea after looking at the code it does seem to be problem with their side. Thank you for your replay, Ill see if tech guns can fix it, otherwise ill do it myself.

TheSorrowX commented 4 years ago

Hi, I have fixed the error in techguns and submitted a PR.

I am not sure if this should be in a new issue but is it possible to have the containerban happen when a player enters a dimension?

With the changes I made the container ban works. however, the item doesn't get banned until the user opens their inventory. In my case, even if I ban the jetpack, it remains unlocked and usable in a banned dimension as long as the user does not open their inventory.

Claycorp commented 4 years ago

Sorry for the late reply.

It already does dim switching bans it should be catching that. I assume that it's not technically part of the players inventory then as IIRC that's whats checked. You could try enabling the aggressive ban mode to see if that helps.