I create CustomSlot for ItemWing i need render 3D model if i wearing ItemWing in customslot. who can help me.
(customslot tech by coolAlias)
if item wearing in ArmorSlot
if item wearing in customslot
customslot class Spoiler:
public class SlotCustom extends Slot
{
public SlotCustom(IInventory inventory, int slotIndex, int x, int y)
{
super(inventory, slotIndex, x, y);
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots
* (and now also not always true for our custom inventory slots)
*/
@Override
public boolean isItemValid(ItemStack itemstack)
{
// We only want our custom item to be storable in this slot
switch (this.getSlotIndex())
{
case 0:
return itemstack.getItem() instanceof ItemArmor;
case 1:
return itemstack.getItem() instanceof ItemSword;
}
return super.isItemValid(itemstack);
}
}
ItemWing Class Spoiler:
public class MyCraftWing1 extends ItemArmor
{
private static final ModelBiped var10 = new WingModel(0.01f);
private static EnumArmorMaterial enuma = EnumHelper.addArmorMaterial("Wing", -1, new int[] {1, 4, 4, 4}, 1);
public Icon overlayIcon;
public MyCraftWing1(int par1)
{
super(par1, enuma, 0, 0);
}
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
return "textures/Wing01.png";
}
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(int id){
return var10; //default, if whenever you should have passed on a wrong id
}
@SideOnly(Side.CLIENT)
ModelBiped armorModel = new ModelBiped();
public ModelBiped getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack, int armorSlot) {
if(itemStack != null){
if(itemStack.getItem() instanceof MyCraftWing1){
int type = ((ItemArmor)itemStack.getItem()).armorType;
i need render 3D model if i wearing ItemWing in customslot.
who can help me.
(customslot tech by coolAlias)
if item wearing in ArmorSlot
if item wearing in customslot
customslot class
Spoiler:
public class SlotCustom extends Slot
{
public SlotCustom(IInventory inventory, int slotIndex, int x, int y)
{
super(inventory, slotIndex, x, y);
}
/**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots
* (and now also not always true for our custom inventory slots)
*/
@Override
public boolean isItemValid(ItemStack itemstack)
{
// We only want our custom item to be storable in this slot
switch (this.getSlotIndex())
{
case 0:
return itemstack.getItem() instanceof ItemArmor;
case 1:
return itemstack.getItem() instanceof ItemSword;
}
return super.isItemValid(itemstack);
}
}
ItemWing Class
Spoiler:
public class MyCraftWing1 extends ItemArmor
{
private static final ModelBiped var10 = new WingModel(0.01f);
private static EnumArmorMaterial enuma = EnumHelper.addArmorMaterial("Wing", -1, new int[] {1, 4, 4, 4}, 1);
public Icon overlayIcon;
public MyCraftWing1(int par1)
{
super(par1, enuma, 0, 0);
}
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
return "textures/Wing01.png";
}
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(int id){
return var10; //default, if whenever you should have passed on a wrong id
}
@SideOnly(Side.CLIENT)
ModelBiped armorModel = new ModelBiped();
public ModelBiped getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack, int armorSlot) {
if(itemStack != null){
if(itemStack.getItem() instanceof MyCraftWing1){
int type = ((ItemArmor)itemStack.getItem()).armorType;
if(type == 1 || type == 1){
armorModel = getArmorModel(1);
}else{
armorModel = getArmorModel(1);
}
}
if(armorModel != null){
armorModel.bipedHead.showModel = armorSlot == 3;
armorModel.bipedHeadwear.showModel = armorSlot == 3;
armorModel.bipedBody.showModel = armorSlot == 0;
armorModel.bipedRightArm.showModel = armorSlot == 3;
armorModel.bipedLeftArm.showModel = armorSlot == 3;
armorModel.bipedRightLeg.showModel = armorSlot == 3;
armorModel.bipedLeftLeg.showModel = armorSlot == 3;
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
armorModel.heldItemRight = entityLiving.getCurrentItemOrArmor(0) != null ? 1 :0;
return armorModel;
}
}
return null;
}
}