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


Java EntityEquipmentSlot.getIndex方法代码示例

本文整理汇总了Java中net.minecraft.inventory.EntityEquipmentSlot.getIndex方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEquipmentSlot.getIndex方法的具体用法?Java EntityEquipmentSlot.getIndex怎么用?Java EntityEquipmentSlot.getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.inventory.EntityEquipmentSlot的用法示例。


在下文中一共展示了EntityEquipmentSlot.getIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertItem

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
{
    EntityEquipmentSlot equ = null;
    for (EntityEquipmentSlot s : EntityEquipmentSlot.values())
    {
        if (s.getSlotType() == EntityEquipmentSlot.Type.ARMOR && s.getIndex() == slot)
        {
            equ = s;
            break;
        }
    }
    // check if it's valid for the armor slot
    if (slot < 4 && stack != null && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player))
    {
        return super.insertItem(slot, stack, simulate);
    }
    return stack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:PlayerArmorInvWrapper.java

示例2: getItemStackFromSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
@Nullable
public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn)
{
    ItemStack itemstack = null;

    switch (slotIn.getSlotType())
    {
        case HAND:
            itemstack = this.handItems[slotIn.getIndex()];
            break;
        case ARMOR:
            itemstack = this.armorItems[slotIn.getIndex()];
    }

    return itemstack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:EntityArmorStand.java

示例3: getItemStackFromSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
@Nullable
public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn)
{
    ItemStack itemstack = null;

    switch (slotIn.getSlotType())
    {
        case HAND:
            itemstack = this.inventoryHands[slotIn.getIndex()];
            break;
        case ARMOR:
            itemstack = this.inventoryArmor[slotIn.getIndex()];
    }

    return itemstack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:EntityLiving.java

示例4: setItemStackToSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
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,代码行数:19,代码来源:EntityPlayer.java

示例5: getSlotTexture

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
@Override
@Nullable
@SideOnly(Side.CLIENT)
public String getSlotTexture() {
	final EntityEquipmentSlot entityequipmentslot = VALID_EQUIPMENT_SLOTS[armorNumber];
	return ItemArmor.EMPTY_SLOT_NAMES[entityequipmentslot.getIndex()];
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:8,代码来源:SlotArmor.java

示例6: dropEquipment

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
/**
 * Drop the equipment for this entity.
 */
protected void dropEquipment(boolean wasRecentlyHit, int lootingModifier)
{
    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);
        double d0;

        switch (entityequipmentslot.getSlotType())
        {
            case HAND:
                d0 = (double)this.inventoryHandsDropChances[entityequipmentslot.getIndex()];
                break;

            case ARMOR:
                d0 = (double)this.inventoryArmorDropChances[entityequipmentslot.getIndex()];
                break;

            default:
                d0 = 0.0D;
        }

        boolean flag = d0 > 1.0D;

        if (!itemstack.func_190926_b() && !EnchantmentHelper.func_190939_c(itemstack) && (wasRecentlyHit || flag) && (double)(this.rand.nextFloat() - (float)lootingModifier * 0.01F) < d0)
        {
            if (!flag && itemstack.isItemStackDamageable())
            {
                itemstack.setItemDamage(itemstack.getMaxDamage() - this.rand.nextInt(1 + this.rand.nextInt(Math.max(itemstack.getMaxDamage() - 3, 1))));
            }

            this.entityDropItem(itemstack, 0.0F);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:EntityLiving.java

示例7: setDropChance

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public void setDropChance(EntityEquipmentSlot slotIn, float chance)
{
    switch (slotIn.getSlotType())
    {
        case HAND:
            this.inventoryHandsDropChances[slotIn.getIndex()] = chance;
            break;

        case ARMOR:
            this.inventoryArmorDropChances[slotIn.getIndex()] = chance;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:EntityLiving.java

示例8: setItemStackToSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public void setItemStackToSlot(EntityEquipmentSlot slotIn, @Nullable ItemStack stack)
{
    switch (slotIn.getSlotType())
    {
        case HAND:
            this.playEquipSound(stack);
            this.handItems[slotIn.getIndex()] = stack;
            break;
        case ARMOR:
            this.playEquipSound(stack);
            this.armorItems[slotIn.getIndex()] = stack;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:EntityArmorStand.java

示例9: setItemStackToSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public void setItemStackToSlot(EntityEquipmentSlot slotIn, @Nullable ItemStack stack)
{
    switch (slotIn.getSlotType())
    {
        case HAND:
            this.inventoryHands[slotIn.getIndex()] = stack;
            break;
        case ARMOR:
            this.inventoryArmor[slotIn.getIndex()] = stack;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:EntityLiving.java

示例10: setDropChance

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public void setDropChance(EntityEquipmentSlot slotIn, float chance)
{
    switch (slotIn.getSlotType())
    {
        case HAND:
            this.inventoryHandsDropChances[slotIn.getIndex()] = chance;
            break;
        case ARMOR:
            this.inventoryArmorDropChances[slotIn.getIndex()] = chance;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:EntityLiving.java

示例11: getDurability

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public int getDurability(EntityEquipmentSlot armorType)
{
    return ItemArmor.MAX_DAMAGE_ARRAY[armorType.getIndex()] * this.maxDamageFactor;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:ItemArmor.java

示例12: getDamageReductionAmount

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
public int getDamageReductionAmount(EntityEquipmentSlot armorType)
{
    return this.damageReductionAmountArray[armorType.getIndex()];
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:ItemArmor.java

示例13: transferStackInSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
/**
 * 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,代码行数:63,代码来源:ContainerWearables.java

示例14: dropEquipment

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
/**
 * Drop the equipment for this entity.
 */
protected void dropEquipment(boolean wasRecentlyHit, int lootingModifier)
{
    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);
        double d0;

        switch (entityequipmentslot.getSlotType())
        {
            case HAND:
                d0 = (double)this.inventoryHandsDropChances[entityequipmentslot.getIndex()];
                break;
            case ARMOR:
                d0 = (double)this.inventoryArmorDropChances[entityequipmentslot.getIndex()];
                break;
            default:
                d0 = 0.0D;
        }

        boolean flag = d0 > 1.0D;

        if (itemstack != null && (wasRecentlyHit || flag) && (double)(this.rand.nextFloat() - (float)lootingModifier * 0.01F) < d0)
        {
            if (!flag && itemstack.isItemStackDamageable())
            {
                int i = Math.max(itemstack.getMaxDamage() - 25, 1);
                int j = itemstack.getMaxDamage() - this.rand.nextInt(this.rand.nextInt(i) + 1);

                if (j > i)
                {
                    j = i;
                }

                if (j < 1)
                {
                    j = 1;
                }

                itemstack.setItemDamage(j);
            }

            this.entityDropItem(itemstack, 0.0F);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:49,代码来源:EntityLiving.java

示例15: getItemStackFromSlot

import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
@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,代码行数:6,代码来源:EntityPlayer.java


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