MyEssentials / MyTown2

Version 2 of MyTown - A Minecraft Server Protection Mod
The Unlicense
35 stars 22 forks source link

ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP #507

Open kratz74 opened 7 years ago

kratz74 commented 7 years ago

Used MyTown2{1.7.10-0.5.0b} with lotr{Beta v29.6 for Minecraft 1.7.10} and TConstruct{1.7.10-1.8.8.build988}. Latest 1.7.10 versions of all those mods were used. An attempt to harvest whole tree using Lumber Axe (the big one) from TConstruct in LOTR world caused

java.lang.ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP
    at mytown.handlers.Ticker.onPlayerBreaksBlock(Ticker.java:78)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_93_Ticker_onPlayerBreaksBlock_BreakEvent.invoke(.dynamic)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    at tconstruct.items.tools.LumberAxe.breakTree(LumberAxe.java:173)
    at tconstruct.items.tools.LumberAxe.onBlockStartBreak(LumberAxe.java:101)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78751_a(PlayerControllerMP.java:96)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78759_c(PlayerControllerMP.java:247)
    at net.minecraft.client.Minecraft.func_147115_a(Minecraft.java:1357)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1967)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
    at net.minecraft.client.main.Main.main(SourceFile:148)
    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:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

to be thrown on client side. This exception kills client. This is not happening in vanilla worlds.

kratz74 commented 7 years ago

fix.zip Here is patch against 0.5.0b which works for me.

Looks like it was not expected in the code to recieve such an event on client side where EntityClientPlayerMP is used instead of EntityPlayerMP. Maybe this event can be ignored at all on client, but I did not have enough time to look into this code deeper. Please fix this ASAP because it's a show stopper.

Eufranio commented 7 years ago

I just banned Lumber Axe, because it causes a StackOverflow when cancelling break events (breaking a tree near a town)

kratz74 commented 7 years ago

I'm still using Lumber Axe in my modpack. I'm fixing all MyTown2 issues myself. Maybe I'll create my own MyTown2 fork with all those changesets to make them public. Or project owners can give me rights to push them here. It's up to them.

Eufranio commented 7 years ago

You could create, I'm fixing stuff too, would be cool for server owners.

kratz74 commented 6 years ago

https://github.com/kratz74/MyTown2 is my fork with few things fixed including this one.