Posted June 12, 201510 yr Hey all, I'm working on a simple npc mod for personal use. EntityNPCCompanion has a Render class that extends RenderBiped and uses ModelBiped. For some reason, whenever I have him extend EntityTameable, he glitches out and falls through the world. Here's my code: public class EntityNPCCompanion extends EntityTameable implements IEntityOwnable { public EntityNPCCompanion(World world) { super(world); this.setTamed(true); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F)); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityMob.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(1, new EntityAILookIdle(this)); } @Override public boolean isAIEnabled() { return true; } @Override public boolean canDespawn() { return false; } @Override public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(60.0D); } @Override public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); if(itemstack == null) { this.func_152115_b(player.getUniqueID().toString()); return true; } else { return true; } } @Override public EntityAgeable createChild(EntityAgeable p_90011_1_) { return null; } } Does anyone know what's wrong? Thanks for your help!
June 12, 201510 yr To clarify, this ONLY happens when you extend EntityTameable, and NOT when you extend any other Entity class? http://i.imgur.com/NdrFdld.png[/img]
June 12, 201510 yr FYI, EntityTameable already implements IEntityOwnable, so you don't need to explicitly implement it in your class (although I don't think it hurts). You need to also post your model class code and your code for registering your renderer. Thanks. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
June 12, 201510 yr Author To clarify, this ONLY happens when you extend EntityTameable, and NOT when you extend any other Entity class? Yup.
June 12, 201510 yr Author FYI, EntityTameable already implements IEntityOwnable, so you don't need to explicitly implement it in your class (although I don't think it hurts). You need to also post your model class code and your code for registering your renderer. Thanks. Here's my RenderNPC: public class RenderNPC extends RenderBiped { public RenderNPC(ModelBiped parModelBase, float par2) { super(parModelBase, par2); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("minecraft:textures/entity/steve.png"); } } Here's my ClientProxy: public class ClientProxy extends CommonProxy { @Override public void registerRendering() { RenderingRegistry.registerEntityRenderingHandler(EntityNPCCompanion.class, new RenderNPC(new ModelBiped(), 0.5F)); } }
June 13, 201510 yr Author Bumperino. If anyone has a solution to this, I'd appreciate all help! (NOTE: I didn't see anything in the rules banning bumping, so... @_@)
June 13, 201510 yr this.setTamed(true); I don't know much about entity tamables but i think you have to set the owner when you set it to tamed.
June 13, 201510 yr Author this.setTamed(true); I don't know much about entity tamables but i think you have to set the owner when you set it to tamed. Erm... Not exactly the question I had in the post, but I appreciate the thought!
June 14, 201510 yr I can't think of any reason why EntityTameable specifically would cause the entity to glitch like that, which leads me to suspect you changed more than just the parent class. You will need to provide us with some EXACT details: set up your code so it works correctly (no falling through ground) and post that. Then change ONLY the parent class to EntityTameable, NOTHING else, and check if that really does cause the issue. http://i.imgur.com/NdrFdld.png[/img]
June 14, 201510 yr Author I can't think of any reason why EntityTameable specifically would cause the entity to glitch like that, which leads me to suspect you changed more than just the parent class. You will need to provide us with some EXACT details: set up your code so it works correctly (no falling through ground) and post that. Then change ONLY the parent class to EntityTameable, NOTHING else, and check if that really does cause the issue. What works: public class EntityNPCCompanion extends EntityMob { public EntityNPCCompanion(World world) { super(world); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityMob.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(1, new EntityAILookIdle(this)); } @Override public boolean isAIEnabled() { return true; } @Override public boolean canDespawn() { return false; } @Override public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(60.0D); } @Override public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); if(itemstack == null) { return true; } else { return false; } } //Commented out because EntityMob didn't like it. // @Override // public EntityAgeable createChild(EntityAgeable p_90011_1_) // { // return null; // } } What doesn't work: public class EntityNPCCompanion extends EntityTameable { public EntityNPCCompanion(World world) { super(world); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityMob.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(1, new EntityAILookIdle(this)); } @Override public boolean isAIEnabled() { return true; } @Override public boolean canDespawn() { return false; } @Override public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(60.0D); } @Override public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); if(itemstack == null) { return true; } else { return false; } } @Override public EntityAgeable createChild(EntityAgeable p_90011_1_) { return null; } }
June 14, 201510 yr Well that certainly is a mystery :\ You should at least implement createChild to not return null and see if that makes any difference (don't see why it would, but then I don't see why what you have isn't working). Other than that, I have no idea, sorry. http://i.imgur.com/NdrFdld.png[/img]
June 14, 201510 yr Author Well that certainly is a mystery :\ You should at least implement createChild to not return null and see if that makes any difference (don't see why it would, but then I don't see why what you have isn't working). Other than that, I have no idea, sorry. Ah, well, I guess if nothing works I could just have it chase the player as an EntityMob but never actually hurt him. Thanks for your help!
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.