Minecraft Comes Alive (MCA)

Minecraft Comes Alive (MCA)

13M Downloads

Crash on Attack Entity

QORTEC opened this issue ยท 33 comments

commented
  • I am running the latest mod versions of MCA and RadixCore.
  • I can reproduce this issue with just MCA and RadixCore installed.
  • I can provide my Minecraft version and MCA version.
  • I have searched for the issue previously and it was either not previously reported, or previously fixed and I'm having the same problem.
  • I am crashing and can provide my crash report.

Versions

Minecraft: 1.7.10
Forge: 10.13.4.1614
MCA: 5.2.1
RadixCore: 2.1.2

Issue Description

Occasionally when attacking entities the game will crash.
I noticed this in the Overworld when hitting a Villager, and in The Last Millennium when attacking mobs.

Reproduce Steps

Attack an entity.

Additional Information

I haven't gotten to fully debugging this issue...

Full Crash Log:
https://gist.github.com/QORTEC/a454c02011133399107d9d3127bf1026

Snippet:

java.lang.ClassCastException: net.minecraft.entity.passive.EntityVillager cannot be cast to mca.entity.EntityHuman
    at mca.core.forge.EventHooksForge.onLivingAttack(EventHooksForge.java:259)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_423_EventHooksForge_onLivingAttack_LivingAttackEvent.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 net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:292)
    at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:737)
    at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1232)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78764_a(PlayerControllerMP.java:406)
    at net.minecraft.client.Minecraft.func_147116_af(Minecraft.java:1393)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1948)
    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)

Snippet:

java.lang.ClassCastException: net.minecraft.entity.passive.EntityVillager cannot be cast to mca.entity.EntityHuman
    at mca.core.forge.EventHooksForge.onLivingAttack(EventHooksForge.java:259)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_421_EventHooksForge_onLivingAttack_LivingAttackEvent.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 net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:292)
    at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:737)
    at tconstruct.library.tools.AbilityHelper.onLeftClickEntity(AbilityHelper.java:126)
    at tconstruct.library.tools.ToolCore.onLeftClickEntity(ToolCore.java:611)
    at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1190)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_78764_a(PlayerControllerMP.java:406)
    at net.minecraft.client.Minecraft.func_147116_af(Minecraft.java:1393)
    at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1948)
    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)
commented

Fixed with commit to RadixCore, will be fixed in next update.

commented

I would like to note that my server is having a similar if not the same issue.
We are running the newest version of both RadixCore and MCA.
We know for a fact the issue is caused by other mods running alongside MCA.

Here is the code we get every time we crash out:
[05:41:11] [Server thread/ERROR]: Exception caught during firing event net.minecraftforge.event.entity.living.LivingAttackEvent@4477ae8f: java.lang.ClassCastException: net.minecraft.entity.passive.EntityVillager cannot be cast to mca.entity.EntityHuman at mca.core.forge.EventHooksForge.onLivingAttack(EventHooksForge.java:259) ~[EventHooksForge.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_21_EventHooksForge_onLivingAttack_LivingAttackEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:1.7.10-1614.UNOFFICIAL] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:1.7.10-1614.UNOFFICIAL] at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:302) [ForgeHooks.class:1.7.10-1614.UNOFFICIAL] at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:850) [sv.class:?] at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1404) [yz.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147340_a(NetHandlerPlayServer.java:1558) [nh.class:?] at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:55) [ja.class:?] at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:10) [ja.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) [ej.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:991) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) [lt.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]

[05:41:11] [Server thread/WARN]: Failed to handle packet for /98.224.48.14:50980 java.lang.ClassCastException: net.minecraft.entity.passive.EntityVillager cannot be cast to mca.entity.EntityHuman at mca.core.forge.EventHooksForge.onLivingAttack(EventHooksForge.java:259) ~[EventHooksForge.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_21_EventHooksForge_onLivingAttack_LivingAttackEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:1.7.10-1614.UNOFFICIAL] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:1.7.10-1614.UNOFFICIAL] at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:302) ~[ForgeHooks.class:1.7.10-1614.UNOFFICIAL] at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:850) ~[sv.class:?] at net.minecraft.entity.player.EntityPlayer.func_71059_n(EntityPlayer.java:1404) ~[yz.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147340_a(NetHandlerPlayServer.java:1558) ~[nh.class:?] at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:55) ~[ja.class:?] at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:10) ~[ja.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) ~[ej.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:991) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) [lt.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] [05:41:11] [Server thread/INFO]: SaignementsRose lost connection: Internal server error [05:41:11] [Server thread/INFO]: SaignementsRose left the game.

Now after roughly 10 man hours of testing I've learned a number of things. First off let me say that for my testing I had only MCA, RadixCore, and 1 other singular mod at any given time installed.

For my first test I did MCA and RadixCore. No issue.

For my second test I did MCA, RadixCore, and Witchery. The issue presents only occasionally. Attacking certain villagers causes the issue, others don't.

For my third test I did MCA, RadixCore, Mantle, and TConstruct. The issue presented every time I attacked a villager. Then I checked TConstructs config and changed 3 lines of code:
B:"Allow villagers to be melted down for emeralds"=true
B:"Add Village Generation"=true
B:"Enable the Tinkers Villager to trade for oreberries"=true
I changed each of these from their default state of "true" to "false". After I made these 3 changes the issue didn't happen again. - I tested by killing over 20 villagers, naturally spawned and manually spawned.

Based on what I can tell, the way MCA is handing villager damage is incompatible with any mod that modifies villagers. Of course I don't know for sure, and I am not a modder. This is an educated guess. Still I hope that my added logs and notes will help this issue possibly be fixed.

commented

@RoseDAmour; Thank you for testing the issue feather, I haven't had the time yet.

Have you noticed any crashes when attacking hostile mobs (not villagers)?
I had 2 crashes in "The Last Millennium" and they where form attacking a Blue Slime and a Zombie or Skeleton (don't remember anymore).

Formatting Tip:

  • GIthub uses markdown to format its text, which means you can use the grave accent to visually separate code form your own text
  • If you highlight your code and click on < > "Insert Code" button (found top of your comment box) it will insert the proper character format your code to be more easily readable and distinguishable .
commented

Hi guys I have same problem, but @RoseDAmour 's solution doesn't work for me :P.. I'm guessing its another mod because I do have a total of 165... I didn't see this post before I opened my own case #760..

commented

From what I'm seeing from the crash reports, when you attack a villager (it only crashes when your in the boundaries of a village) some mod tries to link damage of a regular EntityVillager with the MCA EntityHuman, not sure of the rest..

commented

@QORTEC From what I can tell Drobot432 is on the correct line of thought. I did do some testing with attacking other entities and had no issues as long as there was no villagers nearby. However, if one of the villagers who are effected by this bug were nearby attacking anything caused the bug. I didn't test this aspect of the bug very thoroughly.

I also would like to note that some more testing was done and we have found that Growthcraft also causes the issue. We are unsure of why at this time.

commented

@RoseDAmour thanks for responding and yes ive done some more testing also.. its not just you punching villagers, It can be anything that damages them and that is related to damage dealt by the player... so you know how if you hit a villager they say "ouch" or something? well that means that the game recognized that the damage dealt to that villager came from the player, whereas if you push a villager into lava or something, they don't say ouch, because the damage wasn't dealt by the player.. I even tested this using MachineMuse's Modular Powersuits.. I equipped a railgun on the hand thingy and shot a villager.. boom, crash, but, if you bring the villager away from the village, about at least 3 chunks, you can beat them all you want, no crashing.. this is very confusing lol cant wait for the fix though, sometimes I enjoy punching villagers just to make drama :D.. Btw, is EntityVillager and EntityHuman two different data types? because casting exceptions occur when one piece of data is incompatible with the other during the cast process..

commented

@Drobot432 The thing that confuses me is that if you manually spawn in villagers the villagers still cause the problem. So by manually spawning in villagers are you creating a village on the spot?

I would also like to note that my server has downgraded to 5.1.2 and the issue is no longer happening. Something in the 5.2.0 and 5.2.1 updates are the cause of this incompatibility between MCA and any mod that touches villagers.

commented

@RoseDAmour my guess is that its just villagers within range of other villagers? I have truly no idea whats causing it, but i know a bit about whats happening..

commented

I stepped away form my computer for a couple of hrs, when I got back a player notified me that the server was down and brought my attention to Ars Magica 2.

The player tried to killing hostile mobs, and when using Ars Magica 2 spells it crashed the server.

Full Crash Log:
https://gist.github.com/QORTEC/a454c02011133399107d9d3127bf1026

Snippet:

java.lang.ClassCastException: net.minecraft.entity.passive.EntityVillager cannot be cast to mca.entity.EntityHuman
    at mca.core.forge.EventHooksForge.onLivingAttack(EventHooksForge.java:259)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_390_EventHooksForge_onLivingAttack_LivingAttackEvent.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 net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:292)
    at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:737)
    at net.minecraft.entity.monster.EntityMob.func_70097_a(SourceFile:54)
    at net.minecraft.entity.monster.EntityZombie.func_70097_a(EntityZombie.java:222)
    at am2.spell.SpellHelper.attackTargetSpecial(SpellHelper.java:330)
    at am2.spell.components.FrostDamage.applyEffectEntity(FrostDamage.java:35)
    at am2.spell.SpellHelper.applyStageToEntity(SpellHelper.java:109)
    at am2.entities.EntitySpellProjectile.HitObject(EntitySpellProjectile.java:408)
    at am2.entities.EntitySpellProjectile.func_70071_h_(EntitySpellProjectile.java:355)
    at net.minecraft.world.World.func_72866_a(World.java:2070)
    at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:648)
    at net.minecraft.world.World.func_72870_g(World.java:2034)
    at net.minecraft.world.World.func_72939_s(World.java:1887)
    at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:489)
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:636)
    at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334)
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427)
    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)
commented

btw guys do you think adding discipline to MCA would be a good addition? so like, when your child is young, they do mischevious things, but if you discipline them, they wont do it anymore, so like if they steal something, you punish them, and then they give it back and don't steal again.. now obviously this could be configurable in the config files.. but do you like the idea?

commented

Yes i believe this is because ars magica 2 spells count as player-dealt damage.. but what confuses me is that the game is still casting the EntityVillager to EntityHuman, but he was just attacking hostile mobs, unless he was attacking zombie villagers?

commented

As you two might recall from my original post, I tested and could cause the bug with just MCA, RadixCore, and Witchery. I also caused it with just MCA, RadixCore, and Growthcraft. I also caused it with MCA, RadixCore, and TConstruct - prior to making certain config changes.

So while it doesn't surprise me that there is another mod that could cause this bug to surface, the bug is without a doubt on MCA's side. This is easily confirmed by the fact that if you just downgrade to 5.1.2 the bug vanishes, even when using all of the above mentioned mods.

commented

Yea, ive had 5.1.2 for a while because i didn't know mca updated, but when i updated, punched someone, crash.. btw could any of you possibly know how to fix ars magica 2 potion conflict? qortec mentioned ars magica and i remembered that i had it uninstalled because of some potion id conflict that would make the game crash upon startup.. i know i have to change the potion ids in the am2 config, but i don't know which one to change.. if you need a crash report i could put one in a pastebin.

commented

k fixed the am2 problem i was having, but anyway, how long before you guys think someone will respond with a solution or the mod author will start working on it because this is a major bug... oh, and I'm not sure if this is another mod or something but i have a flatworld with a HUGE village in it with about id say 100+ villagers... but i have to leave it on peaceful because if i don't, at night, when all the mobs come out, i get ticking entity crashes every like 5 seconds.. i load up the game, go into the world, play for 5 seconds, crash... I'm thinking this is also related to this same issue because the ticking entity is an attacking zombie...

UPDATE:
@RoseDAmour just was doing some testing and found out that even when ANY entity within a village takes damage, or even fall damage, not even dealt by the player, the game crashes, and i think that's why I'm getting those ticking entity crashes, because zombies attacking villagers... also, its not just having a bunch of villagers next to each other, i tested that out too.. i put like 5 right next to each other (away from the village) and punched one, no crash..

commented

I have the same crash.... with ordinary villagers, too.

commented

Yes it happens with ANY mob in the area ...

commented

I had this issue on the 1.7.10 version not too long ago. Fortunately, I am also a programmer and after a look through the error and the code, I believe I have found the issue.

The following information is only pertinent to the developer:

The issue appears to be with RadixCore, specifically RadixLogic.getAllEntitiesOfTypeWithinDistance(), and possibly others of the same type of function.

class.isAssignableFrom(class) seems to be backwards to how you're using it. Because you can assign the minecraft villager class to the MCA villagers, any minecraft villagers from other mods are also being returned by this function. So any nearby non-MCA villagers can cause this crash. I have not tested this, but I believe you can do the following instead:

if(clazz.isAssignableFrom(entity.getClass())

commented

Ahh, nice! I also know a bit of coding (enough to have found that) but I did not think to look into radix core.. thanks!

commented

Do not know if it's useful to report when people seem to have figured it out, but: happens for me too.
MC 1.7.10
Forge 10.13.4.1492
MCA 1.7.10-5.2.1
RadixCore 1.7.10-2.1.2

commented

@shadowbolt79 I created a pull request for this: WildBamaBoy/radix-core#26

commented

Why hasn't WildBamaBoy done anything about this? It is only a one line fix.

commented

@Orange1861;

Looking the publicly available information, it looks like @WildBamaBoy is the only developer of MCA, and he hasn't done anything publicly on GitHub for the last 14 days.
I would assume that @WildBamaBoy is currently focusing on real life and hasn't signed into GitHub for the last 2 weeks and doesn't know about the issue.
If the fix is as simple as the above post implies then when @WildBamaBoy returns he will probably look over @shadowbolt79's pull request and update the mod.

commented

K cool can't wait to punch some villagers without notch punishing me and causing a crash!

commented

Yes I noticed that too, but the other villagers don't really matter do they? Or does MCA overwrite the trades for them too?

commented

I found a partial fix, where you can attack other mobs and play with other villager (like forestry) creating mods by enabling villager override so it overrides all villagers (including other mods). The drawback is obvious only MCA villagers can spawn.

commented

I think MCA also overrides the trades.

commented

Oh, well the way I dealt with it so far is to bring all the mca villagers into anot her village that I built, so the regular villagers stay in the old village and the MCA villagers are far enough away from the regular ones so that when they take damage you dont crash... Oh, and another thing, I am away from my computer right now and won't be able to access it so I read the radix core code and I BELIEVE that if the villagers take damage from other mobs, you will get a ticking entity crash also, some one please try to reproduce this all you have to do is spawn regular villager, spawn MCA villager, and spawn zombie and let it attack them while you stand next to them

commented

Looking through the code, the other segments are protected. It's just the player damage part that doesn't have the proper protections on it. Also, I've seen monsters attack NPC's just fine.

commented

Ok thanx, but now I'm confused why I'm getting a ticking entity crash... I mean, it won't be easy to figure out.. the crash report gives me nothing and I have 175+ mods

commented

It's an issue of 'all humans are villagers, but not all villagers are humans'. When something is damaged, it checks for a source of damage. If it's a zombie, it checks to see if what was attacked was human, or player, it infects them. If it's a player, no matter what the player attacked, then it attempts to pull a list of humans (which is gotten through the core) nearby to see if a warrior needs to do something. The problem is this is not receiving a list of humans, it's receiving a list of villagers, other mod villagers included. Those villagers cannot be humans, so it freaks out and crashes when the code tries to call them a human.

commented

So in your dual village case, it will still probably crash if you hit something near the normal villagers regardless. Near the MCA humans it would be fine.

commented

I BELIEVE that if the villagers take damage from other mobs, you will get a ticking entity crash also, some one please try to reproduce this all you have to do is spawn regular villager, spawn MCA villager, and spawn zombie and let it attack them while you stand next to them

Ok, I believe I witnessed what you were talking about here, but this is a slightly different crash. This deals when a zombie infects a villager. Other mobs attacking them were fine. First time I actually witnessed a villager get infected.