本文整理汇总了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));
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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));
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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");
}
示例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));
}
}
}
}
}
}
示例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());
}
示例11: EnchantmentSpin
import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
protected EnchantmentSpin() {
super(Enchantment.Rarity.UNCOMMON, EnumEnchantmentType.WEAPON, EntityEquipmentSlot.values());
this.setName("spin");
}
示例12: EnchantmentDropBL
import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
protected EnchantmentDropBL() {
super(Enchantment.Rarity.RARE, BlockLauncher.enchType, EntityEquipmentSlot.values());
this.setName("dropResistant");
}
示例13: EnchantmentFireBL
import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
protected EnchantmentFireBL() {
super(Enchantment.Rarity.UNCOMMON, BlockLauncher.enchType, EntityEquipmentSlot.values());
this.setName("hellfire");
}
示例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());
}
示例15: EnchantmentGravityBL
import net.minecraft.inventory.EntityEquipmentSlot; //导入方法依赖的package包/类
protected EnchantmentGravityBL() {
super(Enchantment.Rarity.RARE, BlockLauncher.enchType, EntityEquipmentSlot.values());
this.setName("gravity");
}