本文整理汇总了Java中net.minecraft.entity.EntityLiving.getArmorPosition方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLiving.getArmorPosition方法的具体用法?Java EntityLiving.getArmorPosition怎么用?Java EntityLiving.getArmorPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.EntityLiving
的用法示例。
在下文中一共展示了EntityLiving.getArmorPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceItemInInventory
import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
int i;
if (inventorySlot == 99)
{
i = 0;
}
else
{
i = inventorySlot - 100 + 1;
if (i < 0 || i >= this.contents.length)
{
return false;
}
}
if (itemStackIn != null && EntityLiving.getArmorPosition(itemStackIn) != i && (i != 4 || !(itemStackIn.getItem() instanceof ItemBlock)))
{
return false;
}
else
{
this.setCurrentItemOrArmor(i, itemStackIn);
return true;
}
}
示例2: onItemRightClick
import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
int i = EntityLiving.getArmorPosition(itemStackIn) - 1;
ItemStack itemstack = playerIn.getCurrentArmor(i);
if (itemstack == null)
{
playerIn.setCurrentItemOrArmor(i, itemStackIn.copy());
itemStackIn.stackSize = 0;
}
return itemStackIn;
}
示例3: replaceItemInInventory
import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.length)
{
this.inventory.setInventorySlotContents(inventorySlot, itemStackIn);
return true;
}
else
{
int i = inventorySlot - 100;
if (i >= 0 && i < this.inventory.armorInventory.length)
{
int k = i + 1;
if (itemStackIn != null && itemStackIn.getItem() != null)
{
if (itemStackIn.getItem() instanceof ItemArmor)
{
if (EntityLiving.getArmorPosition(itemStackIn) != k)
{
return false;
}
}
else if (k != 4 || itemStackIn.getItem() != Items.skull && !(itemStackIn.getItem() instanceof ItemBlock))
{
return false;
}
}
this.inventory.setInventorySlotContents(i + this.inventory.mainInventory.length, itemStackIn);
return true;
}
else
{
int j = inventorySlot - 200;
if (j >= 0 && j < this.theInventoryEnderChest.getSizeInventory())
{
this.theInventoryEnderChest.setInventorySlotContents(j, itemStackIn);
return true;
}
else
{
return false;
}
}
}
}