Posted June 27, 201510 yr Hello, I am making a achievement mod, and my mod tracks the deaths of entities. I wanted to be able to release a version today, but that is not happening with this bug. Crash Report: http://pastebin.com/WJ0UXPHj I am not trying to cast EntityWolf to Player on purpose, I think its being casted when the wolf kills a rabbit, why it casts to the player confuses me. Code used: (imports lots of stuff) public class SlayHandler { @SubscribeEvent public void KillEntity(LivingDeathEvent event) { EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); } } Intel(R) Core(TM) i7-8700K 32GB DDR4 2400MHz NVIDIA GeForce RTX 2080 8GB
June 27, 201510 yr It is casting a Wolf to player BC u tell it to do so. The event gets called every time an entity is diing. Even if its due to Fall DMG, Explosion, wolves what so ever. Before you cast The source to player, check if it is an instance of player and you are fine
June 27, 201510 yr Author Thank you!! That extra instanceof check fixed the problem! Intel(R) Core(TM) i7-8700K 32GB DDR4 2400MHz NVIDIA GeForce RTX 2080 8GB
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.