Pandoras Creatures

Pandoras Creatures

3M Downloads

Placing the End Troll box makes the player not be able to connect to server.[CRASH]

Dontrell94 opened this issue ยท 11 comments

commented

To Reproduce
Steps to reproduce the crash:

  1. Craft an end troll box.
  2. Place the end troll box
  3. Immediate saving world and disconnect from server

https://gist.github.com/Dontrell94/10e169d9b8f3e742d1dc01dc2550ff5d

Versions
pandoras_creatures-1.16-2.0.0
Forge 34.1.19

latest.log

commented

Tested in creative single player and can replicate by just placing End Troll Box in the world.

https://gist.github.com/Dontrell94/960873879dc67976013bdead7646375e

commented

Can you reproduce the same issue without the other mods installed?
Its a weird log, from the looks of it it attempts to cast one of my blocks to one of vanillas. It may be a mod compatibility issue, do you maybe have any mods that alter Shulker Boxes in some way?
Any way, give it a shot just with forge and my mod, if it works without an issue maybe try to figure out what mod causes the conflict

commented

I have checked a few that have shulker shells in recipes along with just the mod and there is no crashing. so slowly adding in mods to narrow it down.

commented

Sounds good, let me know what mod causes it once you find it, so I can contact to author and try to resolve this issue with him/her

commented

Update as I have found the offending mod and have posted an issue on their github as well as am providing an update here. Tested on both Towncraft 2 live build and test environment (the source of the gist below).

Cross post: Tom-The-Geek/LookAtThat#15

Gist: https://gist.github.com/Dontrell94/815d0fad0742064e2d26b25be470556d

latest.log

commented

I have done some research based on the issue posted on Tom-The-Geek/LookAtThat#15 and have concluded that this issue does lie with this mod.

Here is an explanation of what is wrong:

This is the stacktrace of the crash, and initially this would suggest that my mod is responsible, as the cast exception appears with a reference to my mod below:

Crash report
// Don't do that.

Time: 10/20/20 5:10 AM
Description: Unexpected error

java.lang.ClassCastException: andrews.pandoras_creatures.tile_entities.EndTrollBoxTileEntity cannot be cast to net.minecraft.tileentity.ShulkerBoxTileEntity
	at net.minecraft.block.ShulkerBoxBlock.func_185473_a(ShulkerBoxBlock.java:223) ~[?:?] {re:classloading}
	at me.geek.tom.lat.setup.ClientEventHandler.cameraUpdate(ClientEventHandler.java:73) ~[?:1.8-1.16.2] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_10_ClientEventHandler_cameraUpdate_CameraSetup.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraftforge.client.ForgeHooksClient.onCameraSetup(ForgeHooksClient.java:300) ~[?:?] {re:classloading}
	at net.minecraft.client.renderer.GameRenderer.func_228378_a_(GameRenderer.java:601) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:425) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:953) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:584) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[1.16.3.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_242] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_242] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.16.3-34.1.20.jar:34.1] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-7.0.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-7.0.1.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-7.0.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-7.0.1.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-7.0.1.jar:?] {}

However, upon further analysis, the cast actually occured inside ShulkerBoxBlock#func_185473_a (ShulkerBoxBlock#getItem), which is a vanilla method. The code for that method is as follows:
image
The line number referenced in the crash log is not exact, because of the obfuscation-boundary and decompilation, but the offending cast can be found on line 246.
This method expects that the tile entity at the position of the block is a ShulkerBoxTileEntity, but in the case of the End Troll Box from Pandoras Creatures, the tile entity at that location is not a ShulkerBoxTileEntity, but a EndTrollBoxTileEntity, which does not extend ShulkerBoxTileEntity. This results in the cast failing, and can be fixed overriding the getItem method in the EndTrollBoxBlock class with one that checks the cast.

I hope that my explanation makes sense, and if you have any questions, I'll be happy to help!

commented

Oh my bad, I probably messed up somewhere because I was under the impression func_185473_a was getShape instead of getItem thanks for pointing it out I will look into it ๐Ÿ‘

commented

Yeah, I checked it against the mappings bot, as the line numbers can sometimes throw you off ๐Ÿ™ƒ

commented

Ok I fixed it:
image
This will no longer cause issues in versions after 1.16.3-2.0.0 (current one).

commented

Thanks again for pointing out the method, and sorry for the small inconvenience, if you encounter any more issues let me know and I will fix them!

commented

Np! It wasn't an innconvenience, dw, I'm always happy to help!