Posted June 28, 20178 yr I have created an entity, an explosive to be precise, but the function onLivingUpdate does not appear to be firing at all. I have a println on the initiating of the class saying it has worked and then 2 more print lines in the onLivingUpdate section, these dont seem to be firing however, what am I doing wrong? public class EntityExplosive extends EntityPig { int fuse; EntityPlayer player; BlockPos coords; float explosion; World world; public EntityExplosive(World getworld, BlockPos getcoords, EntityPlayer getplayer, float getexplosion, int getfuse) { super(getworld); System.out.println("it worked"); this.fuse = getfuse; this.player = getplayer; this.coords = getcoords; this.explosion = getexplosion; this.world = getworld; } @Override public void onLivingUpdate() { System.out.println(this.fuse); if(this.fuse != 0) { this.fuse --; System.out.println("counting down"); } if(this.fuse < 1) { this.world.createExplosion(this.player,this.coords.getX(),this.coords.getY(),this.coords.getZ(),this.explosion,true); this.setDead(); return; } super.onLivingUpdate(); } } It extends EntityPig so I didn't have to construct the rest of the class. the variables passed on creation of the EntityExplosive are: the world, the blockpos, the player, 10 and 100. thank you in advance.
June 29, 20178 yr Author Ah! that makes sense. I did do that before (I was following some code form DefenseTech) but didn't think it was necessary, thank you very much!
June 29, 20178 yr Author if I want the entity to have those variables passed on to it when it is created, how would I go about doing that? I seem to be getting a problem with a ticking entity. saying there is a nullPointer on the "createExplosion" line. why is this? the problem in fact seems to lie in the entity not existing past 1 tick... Edited June 29, 20178 yr by Acrogenous
June 30, 20178 yr Author I have since deleted the class as I found an alternative way to get to a solution. I may re-implement this entity at a later date and if I get the same problem I shall post the code and stacktrace here
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.