Jump to content

Recommended Posts

Posted

I am trying to make a block that helps players but hurts everything else. I have looked around and haven't found an answer to this and I am sure that someone else has com across this issue.

 

Here is a copy of the code: http://pastebin.com/xHNiyzuQ

And here is the copy of the crash that I get: http://pastebin.com/WvxhM3aw

 

This only happens if my block has an effect that is being applied to the mob. If there is not effect then it is ok.

 

Thoughts?

Posted

Well, the parameter if the method is of type Entity, yet you blindly cast to EntityLiving:

} else{
   ((EntityLiving)entity).attackEntityFrom(DamageSource.wither, 1.0F);
}

And, as you can see in the crash report, there are all sorts of other entities that might be colliding with the block:

java.lang.ClassCastException: net.minecraft.client.particle.EntityBreakingFX cannot be cast to net.minecraft.entity.EntityLiving

Always perform a type check (e.g. instanceof) before casting to a new type.

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.