本文整理汇总了Java中net.minecraft.inventory.EntityEquipmentSlot.OFFHAND属性的典型用法代码示例。如果您正苦于以下问题:Java EntityEquipmentSlot.OFFHAND属性的具体用法?Java EntityEquipmentSlot.OFFHAND怎么用?Java EntityEquipmentSlot.OFFHAND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.inventory.EntityEquipmentSlot
的用法示例。
在下文中一共展示了EntityEquipmentSlot.OFFHAND属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setItemStackToSlot
public void setItemStackToSlot(EntityEquipmentSlot slotIn, ItemStack stack)
{
if (slotIn == EntityEquipmentSlot.MAINHAND)
{
this.playEquipSound(stack);
this.inventory.mainInventory.set(this.inventory.currentItem, stack);
}
else if (slotIn == EntityEquipmentSlot.OFFHAND)
{
this.playEquipSound(stack);
this.inventory.offHandInventory.set(0, stack);
}
else if (slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
{
this.playEquipSound(stack);
this.inventory.armorInventory.set(slotIn.getIndex(), stack);
}
}
示例2: setItemStackToSlot
public void setItemStackToSlot(EntityEquipmentSlot slotIn, @Nullable ItemStack stack)
{
if (slotIn == EntityEquipmentSlot.MAINHAND)
{
this.playEquipSound(stack);
this.inventory.mainInventory[this.inventory.currentItem] = stack;
}
else if (slotIn == EntityEquipmentSlot.OFFHAND)
{
this.playEquipSound(stack);
this.inventory.offHandInventory[0] = stack;
}
else if (slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
{
this.playEquipSound(stack);
this.inventory.armorInventory[slotIn.getIndex()] = stack;
}
}
示例3: getItemStackFromSlot
public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn)
{
return slotIn == EntityEquipmentSlot.MAINHAND ? this.inventory.getCurrentItem() : (slotIn == EntityEquipmentSlot.OFFHAND ? (ItemStack)this.inventory.offHandInventory.get(0) : (slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR ? (ItemStack)this.inventory.armorInventory.get(slotIn.getIndex()) : ItemStack.field_190927_a));
}
示例4: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
EntityEquipmentSlot entityequipmentslot;
if (inventorySlot == 98)
{
entityequipmentslot = EntityEquipmentSlot.MAINHAND;
}
else if (inventorySlot == 99)
{
entityequipmentslot = EntityEquipmentSlot.OFFHAND;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else
{
if (inventorySlot != 100 + EntityEquipmentSlot.FEET.getIndex())
{
return false;
}
entityequipmentslot = EntityEquipmentSlot.FEET;
}
if (!itemStackIn.func_190926_b() && !EntityLiving.isItemStackInSlot(entityequipmentslot, itemStackIn) && entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
else
{
this.setItemStackToSlot(entityequipmentslot, itemStackIn);
return true;
}
}
示例5: getSlotForItemStack
public static EntityEquipmentSlot getSlotForItemStack(ItemStack stack)
{
return stack.getItem() != Item.getItemFromBlock(Blocks.PUMPKIN) && stack.getItem() != Items.SKULL ? (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType : (stack.getItem() == Items.ELYTRA ? EntityEquipmentSlot.CHEST : (stack.getItem() == Items.SHIELD ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND))) : EntityEquipmentSlot.HEAD;
}
示例6: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
EntityEquipmentSlot entityequipmentslot;
if (inventorySlot == 98)
{
entityequipmentslot = EntityEquipmentSlot.MAINHAND;
}
else if (inventorySlot == 99)
{
entityequipmentslot = EntityEquipmentSlot.OFFHAND;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else
{
if (inventorySlot != 100 + EntityEquipmentSlot.FEET.getIndex())
{
return false;
}
entityequipmentslot = EntityEquipmentSlot.FEET;
}
if (!itemStackIn.func_190926_b() && !isItemStackInSlot(entityequipmentslot, itemStackIn) && entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
else
{
this.setItemStackToSlot(entityequipmentslot, itemStackIn);
return true;
}
}
示例7: isItemStackInSlot
public static boolean isItemStackInSlot(EntityEquipmentSlot slotIn, ItemStack stack)
{
EntityEquipmentSlot entityequipmentslot = getSlotForItemStack(stack);
return entityequipmentslot == slotIn || entityequipmentslot == EntityEquipmentSlot.MAINHAND && slotIn == EntityEquipmentSlot.OFFHAND || entityequipmentslot == EntityEquipmentSlot.OFFHAND && slotIn == EntityEquipmentSlot.MAINHAND;
}
示例8: transferStackInSlot
/**
* Take a stack from the specified inventory slot.
*/
@Override
@Nullable
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemstack);
if (index >= 0 && index < 4) {
if (!this.mergeItemStack(itemstack1, 8, 44, false))
return ItemStack.EMPTY;
} else if (index >= 4 && index < 7) {
if (!this.mergeItemStack(itemstack1, 8, 44, false))
return ItemStack.EMPTY;
} else if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR
&& !this.inventorySlots.get(4 - entityequipmentslot.getIndex()).getHasStack()) {
int i = 4 - entityequipmentslot.getIndex();
if (!this.mergeItemStack(itemstack1, i, i + 1, false))
return ItemStack.EMPTY;
} else if (entityequipmentslot == EntityEquipmentSlot.OFFHAND
&& !this.inventorySlots.get(44).getHasStack()) {
if (!this.mergeItemStack(itemstack1, 44, 45, false))
return ItemStack.EMPTY;
} else if (itemstack1.getItem() instanceof ItemAmmoBelt
&& !this.inventorySlots.get(7).getHasStack()) {
if (!this.mergeItemStack(itemstack1, 7, 8, false))
return ItemStack.EMPTY;
} else if (itemstack1.getItem() instanceof ItemWearable && index >= 8) {
if (!this.mergeItemStack(itemstack1, 4, 7, false))
return ItemStack.EMPTY;
} else if (itemstack1.getItem() instanceof ItemAmmo && ammoBelt && index < 44) {
if (!this.mergeItemStack(itemstack1, 45, 54, false))
return ItemStack.EMPTY;
} else if (index >= 8 && index < 35) {
if (!this.mergeItemStack(itemstack1, 35, 44, false))
return ItemStack.EMPTY;
} else if (index >= 35 && index < 44) {
if (!this.mergeItemStack(itemstack1, 8, 35, false))
return ItemStack.EMPTY;
} else if (!this.mergeItemStack(itemstack1, 8, 44, false))
return ItemStack.EMPTY;
if (itemstack1.isEmpty())
slot.putStack(ItemStack.EMPTY);
else
slot.onSlotChanged();
if (itemstack1.getCount() ==itemstack.getCount())
return ItemStack.EMPTY;
slot.onTake(playerIn, itemstack1);
}
return itemstack;
}
示例9: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, @Nullable ItemStack itemStackIn)
{
EntityEquipmentSlot entityequipmentslot;
if (inventorySlot == 98)
{
entityequipmentslot = EntityEquipmentSlot.MAINHAND;
}
else if (inventorySlot == 99)
{
entityequipmentslot = EntityEquipmentSlot.OFFHAND;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else
{
if (inventorySlot != 100 + EntityEquipmentSlot.FEET.getIndex())
{
return false;
}
entityequipmentslot = EntityEquipmentSlot.FEET;
}
if (itemStackIn != null && !EntityLiving.isItemStackInSlot(entityequipmentslot, itemStackIn) && entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
else
{
this.setItemStackToSlot(entityequipmentslot, itemStackIn);
return true;
}
}
示例10: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, @Nullable ItemStack itemStackIn)
{
EntityEquipmentSlot entityequipmentslot;
if (inventorySlot == 98)
{
entityequipmentslot = EntityEquipmentSlot.MAINHAND;
}
else if (inventorySlot == 99)
{
entityequipmentslot = EntityEquipmentSlot.OFFHAND;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.HEAD.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.CHEST.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (inventorySlot == 100 + EntityEquipmentSlot.LEGS.getIndex())
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else
{
if (inventorySlot != 100 + EntityEquipmentSlot.FEET.getIndex())
{
return false;
}
entityequipmentslot = EntityEquipmentSlot.FEET;
}
if (itemStackIn != null && !isItemStackInSlot(entityequipmentslot, itemStackIn) && entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
else
{
this.setItemStackToSlot(entityequipmentslot, itemStackIn);
return true;
}
}
示例11: getItemStackFromSlot
@Nullable
public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn)
{
return slotIn == EntityEquipmentSlot.MAINHAND ? this.inventory.getCurrentItem() : (slotIn == EntityEquipmentSlot.OFFHAND ? this.inventory.offHandInventory[0] : (slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR ? this.inventory.armorInventory[slotIn.getIndex()] : null));
}
示例12: registerEnchantments
public static void registerEnchantments()
{
runicenchantment = new EnchantmentOmni(Enchantment.Rarity.RARE, EntityEquipmentSlot.MAINHAND, EntityEquipmentSlot.OFFHAND);
GameRegistry.register(runicenchantment, new ResourceLocation(RunicArcana.MOD_ID, runicenchantment.getName()));
}