Jump to content

[1.7.10] [SOLVED] entity equipment rendering error help


Recommended Posts

Posted

so i have made a mob that picks up items and stores them in an ItemStack array called equipment

but when the mob picks up a block it does not render it in the mobs hand can somebody help me

the same happens for armor when it picks up armor the mob has the armor and its health is scaled up depending on what the armor is and how much it protects you but it doesn't render and when the mob dies the items in the array are dropped so they are being stored but not rendered any help

 

note that the Itemstack array is the default equipment array in EntityLiving

 

My mobs code

package com.dogz.mods.Players.Entity;

import com.dogz.mods.Players.Helper.EntityHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.init.Items;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class EntityPlayerExtendable extends EntityLiving
{
public EntityPlayerExtendable(World world)
{
	super(world);

	setCanPickUpLoot(true); //makes it so the mob can pick up items
}

        //called when the mob picks up a item
@Override public void onItemPickup(Entity entity, int stackSize) 
{
	super.onItemPickup(entity, stackSize);

	if(!(worldObj.isRemote))
	{
		if(entity instanceof EntityItem) //makes sure it is item (fixes crashes)
		{
			EntityItem entityItem = (EntityItem) entity;
			ItemStack stack = entityItem.getEntityItem();
                                
                                //make our mob wear skulls
			if(stack.getItem() == Items.skull) setCurrentItemOrArmor(1, stack);
                                //make our mob wear armor
			else if(stack.getItem() instanceof ItemArmor)
			{
				ItemArmor armor = (ItemArmor) stack.getItem();
				setCurrentItemOrArmor(armor.armorType + 1, stack);
			}
                                //make our mob wield the item
			else setCurrentItemOrArmor(0, stack);
		}
	}
}
}

 

SOLUTION: made my custom renderer extend RenderBiped not RenderLiving

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.