Jump to content

[1.7.10] Tameable Biped Problems


DaveTheModder

Recommended Posts

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. :o

 

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!

Link to comment
Share on other sites

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));

}

}

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;

}

}

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.