当前位置: 首页>>代码示例>>Java>>正文


Java EntityEquipmentSlot.OFFHAND属性代码示例

本文整理汇总了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);
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:18,代码来源:EntityPlayer.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:EntityPlayer.java

示例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));
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:EntityPlayer.java

示例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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:44,代码来源:EntityArmorStand.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:4,代码来源:EntityLiving.java

示例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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:44,代码来源:EntityLiving.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:EntityLiving.java

示例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;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:62,代码来源:ContainerWearables.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:44,代码来源:EntityArmorStand.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:44,代码来源:EntityLiving.java

示例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));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:EntityPlayer.java

示例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()));

}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:7,代码来源:ModEnchantment.java


注:本文中的net.minecraft.inventory.EntityEquipmentSlot.OFFHAND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。