Jump to content

Recommended Posts

Posted

I'm trying to make a creeper-like mob (it extends EntityCreeper) that explodes and then burns all mobs in an x-block radius. The explosion works fine but the burning code (specifically the part that gets all mobs in the radius) is giving me an NPE "exception ticking entity". Is there a better way to do this? Code below:

 

List<EntityLiving> theList = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, this.getBoundingBox().expand(eR, eR, eR));. //This line is the code referenced during the crash report
           
            for(EntityLiving entity: theList)
            {
            	if(entity != null)
            	{
            	    entity.setFire(;
            	}
            }

Posted

First, you should articulate your code (assign each method result to a local variable before passing vars to the next method). Then set a break point and fire up the debugger to step through the articulated code, looking at values at each line. Find out exactly what is null. If you discover why it is null, then you don't even need our help. If not, then you can ask a better-informed question.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.

×
×
  • Create New...

Important Information

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