Jump to content

Recommended Posts

Posted

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

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.