本文整理匯總了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;
}
}
}
}