當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityEquipmentSlot.values方法代碼示例

本文整理匯總了Java中net.minecraft.inventory.EntityEquipmentSlot.values方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityEquipmentSlot.values方法的具體用法?Java EntityEquipmentSlot.values怎麽用?Java EntityEquipmentSlot.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.inventory.EntityEquipmentSlot的用法示例。


在下文中一共展示了EntityEquipmentSlot.values方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setEnchantmentBasedOnDifficulty

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * Enchants Entity's current equipments based on given DifficultyInstance
 */
protected void setEnchantmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    float f = difficulty.getClampedAdditionalDifficulty();

    if (!this.getHeldItemMainhand().func_190926_b() && this.rand.nextFloat() < 0.25F * f)
    {
        this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItemMainhand(), (int)(5.0F + f * (float)this.rand.nextInt(18)), false));
    }

    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
        {
            ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);

            if (!itemstack.func_190926_b() && this.rand.nextFloat() < 0.5F * f)
            {
                this.setItemStackToSlot(entityequipmentslot, EnchantmentHelper.addRandomEnchantment(this.rand, itemstack, (int)(5.0F + f * (float)this.rand.nextInt(18)), false));
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:26,代碼來源:EntityLiving.java

示例2: onContainerClosed

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
public void onContainerClosed(EntityPlayer playerIn)
{
    super.onContainerClosed(playerIn);
    if(!this.mercenary.world.isRemote) {
     for(int i=0;i<3;i++) {
     	if(!this.mercenary.loadoutHeld.getStackInSlot(i).isEmpty()) {
     		ItemStack buf = this.mercenary.loadout.getStackInSlot(i);
     		this.mercenary.loadout.setStackInSlot(i, this.mercenary.loadoutHeld.getStackInSlot(0));
     		this.mercenary.loadoutHeld.setStackInSlot(i, buf);
     	}
     }
     this.mercenary.switchSlot(this.mercenary.preferredSlot);
     
     for(EntityEquipmentSlot slot : EntityEquipmentSlot.values()) {
     	if(slot.getSlotType() == Type.ARMOR) {
     		//System.out.println("Not empt:" + slot);
     		this.mercenary.setDropChance(slot, !this.mercenary.getItemStackFromSlot(slot).isEmpty() ? 2.0f : 0.25f);
     	}
     }
     
     if(this.mercenary.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty() && this.mercenary.loadoutHeld.getStackInSlot(3).getItem() instanceof ItemWearable) {
     	this.mercenary.setItemStackToSlot(EntityEquipmentSlot.HEAD, this.mercenary.loadoutHeld.getStackInSlot(3));
     	this.mercenary.loadoutHeld.setStackInSlot(3, ItemStack.EMPTY);
     }
    }
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:27,代碼來源:ContainerMercenary.java

示例3: setEnchantmentBasedOnDifficulty

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * Enchants Entity's current equipments based on given DifficultyInstance
 */
protected void setEnchantmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    float f = difficulty.getClampedAdditionalDifficulty();

    if (this.getHeldItemMainhand() != null && this.rand.nextFloat() < 0.25F * f)
    {
        EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItemMainhand(), (int)(5.0F + f * (float)this.rand.nextInt(18)), false);
    }

    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
        {
            ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);

            if (itemstack != null && this.rand.nextFloat() < 0.5F * f)
            {
                EnchantmentHelper.addRandomEnchantment(this.rand, itemstack, (int)(5.0F + f * (float)this.rand.nextInt(18)), false);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:EntityLiving.java

示例4: isItemValid

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * Check if the stack is a valid item for this slot. Always true beside for
 * the armor slots.
 */
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
    Item item = par1ItemStack.getItem();
    EntityEquipmentSlot eq = EntityEquipmentSlot.values()[armorType + 2];  // 0 & 1 are main & off hands
    return item.isValidArmor(par1ItemStack, eq, player);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:11,代碼來源:SlotPneumaticArmor.java

示例5: onEntityTick

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
@SubscribeEvent
public void onEntityTick(LivingUpdateEvent event)
{
	int i = 0;
	for(EntityEquipmentSlot slot : EntityEquipmentSlot.values())
		if(slot.getSlotType() == Type.ARMOR && allArmour.contains(event.getEntityLiving().getItemStackFromSlot(slot).getItem()))
			i++;
	if(i == 4)
	{
		event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 225, 0, false, false));
		event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.SPEED, 30, 0, false, false));
		event.getEntityLiving().addPotionEffect(new PotionEffect(HarshenPotions.potionSoulless, 330, 0, false, false));
	}
			
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:16,代碼來源:HandlerHarshenArmourEffects.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: 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

示例8: EmpoweredEnchantment

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
public EmpoweredEnchantment() {
    super(Rarity.COMMON, EnumEnchantmentType.ALL, EntityEquipmentSlot.values());
    this.setName("randores.empowered");
    this.setRegistryName("randores.empowered");
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:6,代碼來源:EmpoweredEnchantment.java

示例9: setEquipmentBasedOnDifficulty

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * Gives armor or weapon for entity based on given DifficultyInstance
 */
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
    if (this.rand.nextFloat() < 0.15F * difficulty.getClampedAdditionalDifficulty())
    {
        int i = this.rand.nextInt(2);
        float f = this.world.getDifficulty() == EnumDifficulty.HARD ? 0.1F : 0.25F;

        if (this.rand.nextFloat() < 0.095F)
        {
            ++i;
        }

        if (this.rand.nextFloat() < 0.095F)
        {
            ++i;
        }

        if (this.rand.nextFloat() < 0.095F)
        {
            ++i;
        }

        boolean flag = true;

        for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
        {
            if (entityequipmentslot.getSlotType() == EntityEquipmentSlot.Type.ARMOR)
            {
                ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);

                if (!flag && this.rand.nextFloat() < f)
                {
                    break;
                }

                flag = false;

                if (itemstack.func_190926_b())
                {
                    Item item = getArmorByChance(entityequipmentslot, i);

                    if (item != null)
                    {
                        this.setItemStackToSlot(entityequipmentslot, new ItemStack(item));
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:EntityLiving.java

示例10: writeEntityToNBT

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    compound.setFloat("Health", this.getHealth());
    compound.setShort("HurtTime", (short)this.hurtTime);
    compound.setInteger("HurtByTimestamp", this.revengeTimer);
    compound.setShort("DeathTime", (short)this.deathTime);
    compound.setFloat("AbsorptionAmount", this.getAbsorptionAmount());

    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);

        if (!itemstack.func_190926_b())
        {
            this.getAttributeMap().removeAttributeModifiers(itemstack.getAttributeModifiers(entityequipmentslot));
        }
    }

    compound.setTag("Attributes", SharedMonsterAttributes.writeBaseAttributeMapToNBT(this.getAttributeMap()));

    for (EntityEquipmentSlot entityequipmentslot1 : EntityEquipmentSlot.values())
    {
        ItemStack itemstack1 = this.getItemStackFromSlot(entityequipmentslot1);

        if (!itemstack1.func_190926_b())
        {
            this.getAttributeMap().applyAttributeModifiers(itemstack1.getAttributeModifiers(entityequipmentslot1));
        }
    }

    if (!this.activePotionsMap.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (PotionEffect potioneffect : this.activePotionsMap.values())
        {
            nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
        }

        compound.setTag("ActiveEffects", nbttaglist);
    }

    compound.setBoolean("FallFlying", this.isElytraFlying());
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:48,代碼來源:EntityLivingBase.java

示例11: EnchantmentSpin

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
protected EnchantmentSpin() {
	super(Enchantment.Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, EntityEquipmentSlot.values());
	this.setName("spin");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:5,代碼來源:EnchantmentSpin.java

示例12: EnchantmentDropBL

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
protected EnchantmentDropBL() {
	super(Enchantment.Rarity.RARE, BlockLauncher.enchType, EntityEquipmentSlot.values());
	this.setName("dropResistant");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:5,代碼來源:EnchantmentDropBL.java

示例13: EnchantmentFireBL

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
protected EnchantmentFireBL() {
	super(Enchantment.Rarity.UNCOMMON, BlockLauncher.enchType, EntityEquipmentSlot.values());
	this.setName("hellfire");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:5,代碼來源:EnchantmentFireBL.java

示例14: writeEntityToNBT

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    compound.setFloat("Health", this.getHealth());
    compound.setShort("HurtTime", (short)this.hurtTime);
    compound.setInteger("HurtByTimestamp", this.revengeTimer);
    compound.setShort("DeathTime", (short)this.deathTime);
    compound.setFloat("AbsorptionAmount", this.getAbsorptionAmount());

    for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values())
    {
        ItemStack itemstack = this.getItemStackFromSlot(entityequipmentslot);

        if (itemstack != null)
        {
            this.getAttributeMap().removeAttributeModifiers(itemstack.getAttributeModifiers(entityequipmentslot));
        }
    }

    compound.setTag("Attributes", SharedMonsterAttributes.writeBaseAttributeMapToNBT(this.getAttributeMap()));

    for (EntityEquipmentSlot entityequipmentslot1 : EntityEquipmentSlot.values())
    {
        ItemStack itemstack1 = this.getItemStackFromSlot(entityequipmentslot1);

        if (itemstack1 != null)
        {
            this.getAttributeMap().applyAttributeModifiers(itemstack1.getAttributeModifiers(entityequipmentslot1));
        }
    }

    if (!this.activePotionsMap.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (PotionEffect potioneffect : this.activePotionsMap.values())
        {
            nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
        }

        compound.setTag("ActiveEffects", nbttaglist);
    }

    compound.setBoolean("FallFlying", this.isElytraFlying());
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:48,代碼來源:EntityLivingBase.java

示例15: EnchantmentGravityBL

import net.minecraft.inventory.EntityEquipmentSlot; //導入方法依賴的package包/類
protected EnchantmentGravityBL() {
	super(Enchantment.Rarity.RARE, BlockLauncher.enchType, EntityEquipmentSlot.values());
	this.setName("gravity");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:5,代碼來源:EnchantmentGravityBL.java


注:本文中的net.minecraft.inventory.EntityEquipmentSlot.values方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。