本文整理汇总了Java中net.minecraft.inventory.EntityEquipmentSlot.CHEST属性的典型用法代码示例。如果您正苦于以下问题:Java EntityEquipmentSlot.CHEST属性的具体用法?Java EntityEquipmentSlot.CHEST怎么用?Java EntityEquipmentSlot.CHEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.inventory.EntityEquipmentSlot
的用法示例。
在下文中一共展示了EntityEquipmentSlot.CHEST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_190772_a
protected EntityEquipmentSlot func_190772_a(Vec3d p_190772_1_)
{
EntityEquipmentSlot entityequipmentslot = EntityEquipmentSlot.MAINHAND;
boolean flag = this.isSmall();
double d0 = flag ? p_190772_1_.yCoord * 2.0D : p_190772_1_.yCoord;
EntityEquipmentSlot entityequipmentslot1 = EntityEquipmentSlot.FEET;
if (d0 >= 0.1D && d0 < 0.1D + (flag ? 0.8D : 0.45D) && this.func_190630_a(entityequipmentslot1))
{
entityequipmentslot = EntityEquipmentSlot.FEET;
}
else if (d0 >= 0.9D + (flag ? 0.3D : 0.0D) && d0 < 0.9D + (flag ? 1.0D : 0.7D) && this.func_190630_a(EntityEquipmentSlot.CHEST))
{
entityequipmentslot = EntityEquipmentSlot.CHEST;
}
else if (d0 >= 0.4D && d0 < 0.4D + (flag ? 1.0D : 0.8D) && this.func_190630_a(EntityEquipmentSlot.LEGS))
{
entityequipmentslot = EntityEquipmentSlot.LEGS;
}
else if (d0 >= 1.6D && this.func_190630_a(EntityEquipmentSlot.HEAD))
{
entityequipmentslot = EntityEquipmentSlot.HEAD;
}
return entityequipmentslot;
}
示例2: getAttributeModifiers
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
if (slot == EntityEquipmentSlot.CHEST) {
multimap.put(SharedMonsterAttributes.ARMOR.getName(),
new AttributeModifier(UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), "Armor modifier",
getData(stack).getFloat(PropertyType.ARMOR), 0));
multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(),
new AttributeModifier(UUID.fromString("D8499B04-0E66-4726-AB29-64469D734BCD"), "Health modifier",
TF2Attribute.getModifier("Health", stack, 0, null), 0));
multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(),
new AttributeModifier(UUID.fromString("D8499B04-0E66-4726-AB29-64469D734AB7"),
"Armor toughness modifier", getData(stack).getFloat(PropertyType.ARMOR_TOUGHNESS), 0));
}
return multimap;
}
示例3: preInit
public static void preInit()
{
harshen_jaguar_armor_helmet = new HarshenJaguarArmor(harshen_material, 1, EntityEquipmentSlot.HEAD, "harshen_jaguar_armor_helmet");
harshen_jaguar_armor_chestplate = new HarshenJaguarArmor(harshen_material, 1, EntityEquipmentSlot.CHEST, "harshen_jaguar_armor_chestplate");
harshen_jaguar_armor_leggings = new HarshenJaguarArmor(harshen_material, 1, EntityEquipmentSlot.LEGS, "harshen_jaguar_armor_leggings");
harshen_jaguar_armor_boots = new HarshenJaguarArmor(harshen_material, 1, EntityEquipmentSlot.FEET, "harshen_jaguar_armor_boots");
}
示例4: ItemArmorCollection
public ItemArmorCollection(ItemArmor.ArmorMaterial material){
this.material = material;
head = new Armor(material, EntityEquipmentSlot.HEAD);
chestplate = new Armor(material, EntityEquipmentSlot.CHEST);
legs = new Armor(material, EntityEquipmentSlot.LEGS);
shoes = new Armor(material, EntityEquipmentSlot.FEET);
}
示例5: registerEnchantments
/**
* Registers all of the vanilla enchantments.
*/
public static void registerEnchantments()
{
EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
REGISTRY.register(0, new ResourceLocation("protection"), new EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.ALL, aentityequipmentslot));
REGISTRY.register(1, new ResourceLocation("fire_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FIRE, aentityequipmentslot));
REGISTRY.register(2, new ResourceLocation("feather_falling"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.FALL, aentityequipmentslot));
REGISTRY.register(3, new ResourceLocation("blast_protection"), new EnchantmentProtection(Enchantment.Rarity.RARE, EnchantmentProtection.Type.EXPLOSION, aentityequipmentslot));
REGISTRY.register(4, new ResourceLocation("projectile_protection"), new EnchantmentProtection(Enchantment.Rarity.UNCOMMON, EnchantmentProtection.Type.PROJECTILE, aentityequipmentslot));
REGISTRY.register(5, new ResourceLocation("respiration"), new EnchantmentOxygen(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(6, new ResourceLocation("aqua_affinity"), new EnchantmentWaterWorker(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(7, new ResourceLocation("thorns"), new EnchantmentThorns(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
REGISTRY.register(8, new ResourceLocation("depth_strider"), new EnchantmentWaterWalker(Enchantment.Rarity.RARE, aentityequipmentslot));
REGISTRY.register(9, new ResourceLocation("frost_walker"), new EnchantmentFrostWalker(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.FEET}));
REGISTRY.register(10, new ResourceLocation("binding_curse"), new EnchantmentBindingCurse(Enchantment.Rarity.VERY_RARE, aentityequipmentslot));
REGISTRY.register(16, new ResourceLocation("sharpness"), new EnchantmentDamage(Enchantment.Rarity.COMMON, 0, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(17, new ResourceLocation("smite"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 1, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(18, new ResourceLocation("bane_of_arthropods"), new EnchantmentDamage(Enchantment.Rarity.UNCOMMON, 2, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(19, new ResourceLocation("knockback"), new EnchantmentKnockback(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(20, new ResourceLocation("fire_aspect"), new EnchantmentFireAspect(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(21, new ResourceLocation("looting"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.WEAPON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(22, new ResourceLocation("sweeping"), new EnchantmentSweepingEdge(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(32, new ResourceLocation("efficiency"), new EnchantmentDigging(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(33, new ResourceLocation("silk_touch"), new EnchantmentUntouching(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(34, new ResourceLocation("unbreaking"), new EnchantmentDurability(Enchantment.Rarity.UNCOMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(35, new ResourceLocation("fortune"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.DIGGER, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(48, new ResourceLocation("power"), new EnchantmentArrowDamage(Enchantment.Rarity.COMMON, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(49, new ResourceLocation("punch"), new EnchantmentArrowKnockback(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(50, new ResourceLocation("flame"), new EnchantmentArrowFire(Enchantment.Rarity.RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(51, new ResourceLocation("infinity"), new EnchantmentArrowInfinite(Enchantment.Rarity.VERY_RARE, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(61, new ResourceLocation("luck_of_the_sea"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(62, new ResourceLocation("lure"), new EnchantmentFishingSpeed(Enchantment.Rarity.RARE, EnumEnchantmentType.FISHING_ROD, new EntityEquipmentSlot[] {EntityEquipmentSlot.MAINHAND}));
REGISTRY.register(70, new ResourceLocation("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EntityEquipmentSlot.values()));
REGISTRY.register(71, new ResourceLocation("vanishing_curse"), new EnchantmentVanishingCurse(Enchantment.Rarity.VERY_RARE, EntityEquipmentSlot.values()));
}
示例6: getAttributeModifiers
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
if (slot == EntityEquipmentSlot.CHEST) {
multimap.put(SharedMonsterAttributes.ARMOR.getName(),
new AttributeModifier(UUID.fromString("D8499B04-0E66-4726-AB29-64469D234E0D"), "Armor modifier", getData(stack).getFloat(PropertyType.ARMOR), 0));
multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(),
new AttributeModifier(UUID.fromString("D8499B04-0E66-4726-AB29-64469D234AB7"),
"Armor toughness modifier", getData(stack).getFloat(PropertyType.ARMOR_TOUGHNESS), 0));
}
return multimap;
}
示例7: 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;
}
}
示例8: 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;
}
}
示例9: 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;
}
示例10: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.size())
{
this.inventory.setInventorySlotContents(inventorySlot, itemStackIn);
return true;
}
else
{
EntityEquipmentSlot entityequipmentslot;
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())
{
entityequipmentslot = EntityEquipmentSlot.FEET;
}
else
{
entityequipmentslot = null;
}
if (inventorySlot == 98)
{
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, itemStackIn);
return true;
}
else if (inventorySlot == 99)
{
this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, itemStackIn);
return true;
}
else if (entityequipmentslot == null)
{
int i = inventorySlot - 200;
if (i >= 0 && i < this.theInventoryEnderChest.getSizeInventory())
{
this.theInventoryEnderChest.setInventorySlotContents(i, itemStackIn);
return true;
}
else
{
return false;
}
}
else
{
if (!itemStackIn.func_190926_b())
{
if (!(itemStackIn.getItem() instanceof ItemArmor) && !(itemStackIn.getItem() instanceof ItemElytra))
{
if (entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
}
else if (EntityLiving.getSlotForItemStack(itemStackIn) != entityequipmentslot)
{
return false;
}
}
this.inventory.setInventorySlotContents(entityequipmentslot.getIndex() + this.inventory.mainInventory.size(), itemStackIn);
return true;
}
}
}
示例11: init
public static void init() {
UCBaubles.init();
seedsNormal = new ItemSeedsUC(UCBlocks.cropNormal);
seedsPrecision = new ItemSeedsUC(UCBlocks.cropPrecision);
seedsKnowledge = new ItemSeedsUC(UCBlocks.cropKnowledge);
seedsDirigible = new ItemSeedsUC(UCBlocks.cropDirigible);
seedsMillennium = new ItemSeedsUC(UCBlocks.cropMillennium);
seedsEnderlily = new ItemSeedsUC(UCBlocks.cropEnderlily);
seedsCollis = new ItemSeedsUC(UCBlocks.cropCollis);
seedsInvisibilia = new ItemSeedsUC(UCBlocks.cropInvisibilia);
seedsMaryjane = new ItemSeedsUC(UCBlocks.cropMaryjane);
seedsWeepingbells = new ItemSeedsUC(UCBlocks.cropWeepingbells);
seedsMusica = new ItemSeedsUC(UCBlocks.cropMusica);
seedsCinderbella = new ItemSeedsUC(UCBlocks.cropCinderbella);
seedsMerlinia = new ItemSeedsUC(UCBlocks.cropMerlinia);
seedsFeroxia = new ItemSeedsUC(UCBlocks.cropFeroxia);
seedsEula = new ItemSeedsUC(UCBlocks.cropEula);
seedsCobblonia = new ItemSeedsUC(UCBlocks.cropCobblonia);
seedsDyeius = new ItemSeedsUC(UCBlocks.cropDyeius);
seedsAbstract = new ItemSeedsUC(UCBlocks.cropAbstract);
seedsWafflonia = new ItemSeedsUC(UCBlocks.cropWafflonia);
seedsDevilsnare = new ItemSeedsUC(UCBlocks.cropDevilsnare);
seedsPixelsius = new ItemSeedsUC(UCBlocks.cropPixelsius);
seedsArtisia = new ItemSeedsUC(UCBlocks.cropArtisia);
seedsPetramia = new ItemSeedsUC(UCBlocks.cropPetramia);
seedsMalleatoris = new ItemSeedsUC(UCBlocks.cropMalleatoris);
generic = new ItemGeneric();
largeplum = new ItemGenericFood(1, 0.6F, true, "largeplum");
teriyaki = new ItemGenericFood(16, 1.0F, false, "teriyaki").setContainerItem(Items.BOWL);
heart = new ItemGenericFood(0, 0F, true, "heart");
potionreverse = new ItemGenericFood(0, 0F, true, "reversepotion");
goldenbread = new ItemGenericFood(4, 0.3F, false, "goldenbread");
dietpills = new ItemGenericFood(-4, 0, true, "dietpills");
waffle = new ItemGenericFood(8, 1.0F, false, "waffle");
endersnooker = new ItemEnderSnooker();
edibleDiamond = new ItemEdibleMetal(EnumEdibleMetal.GEM, "diamond");
edibleEmerald = new ItemEdibleMetal(EnumEdibleMetal.GEM, "emerald");
edibleLapis = new ItemEdibleMetal(EnumEdibleMetal.NUGGET, "lapis");
edibleIngotIron = new ItemEdibleMetal(EnumEdibleMetal.INGOT, "ironingot");
edibleIngotGold = new ItemEdibleMetal(EnumEdibleMetal.INGOT, "goldingot");
edibleNuggetGold = new ItemEdibleMetal(EnumEdibleMetal.NUGGET, "goldnugget");
glasses3D = new Item3DGlasses(glassesmaterial, 1, EntityEquipmentSlot.HEAD);
pixelglasses = new ItemPixelGlasses(pixelmaterial, 1, EntityEquipmentSlot.HEAD);
poncho = new ItemPoncho(ponchomaterial, 1, EntityEquipmentSlot.CHEST);
slippers = new ItemGlassSlippers(slippermaterial, 2, EntityEquipmentSlot.FEET);
precisionPick = new ItemPrecisionPick();
precisionAxe = new ItemPrecisionAxe();
precisionShovel = new ItemPrecisionShovel();
OreDictionary.registerOre("gemDiamond", edibleDiamond);
OreDictionary.registerOre("gemEmerald", edibleEmerald);
OreDictionary.registerOre("gemLapis", edibleLapis);
OreDictionary.registerOre("ingotIron", edibleIngotIron);
OreDictionary.registerOre("ingotGold", edibleIngotGold);
OreDictionary.registerOre("nuggetGold", edibleNuggetGold);
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: replaceItemInInventory
public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn)
{
if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.length)
{
this.inventory.setInventorySlotContents(inventorySlot, itemStackIn);
return true;
}
else
{
EntityEquipmentSlot entityequipmentslot;
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())
{
entityequipmentslot = EntityEquipmentSlot.FEET;
}
else
{
entityequipmentslot = null;
}
if (inventorySlot == 98)
{
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, itemStackIn);
return true;
}
else if (inventorySlot == 99)
{
this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, itemStackIn);
return true;
}
else if (entityequipmentslot == null)
{
int i = inventorySlot - 200;
if (i >= 0 && i < this.theInventoryEnderChest.getSizeInventory())
{
this.theInventoryEnderChest.setInventorySlotContents(i, itemStackIn);
return true;
}
else
{
return false;
}
}
else
{
if (itemStackIn != null && itemStackIn.getItem() != null)
{
if (!(itemStackIn.getItem() instanceof ItemArmor) && !(itemStackIn.getItem() instanceof ItemElytra))
{
if (entityequipmentslot != EntityEquipmentSlot.HEAD)
{
return false;
}
}
else if (EntityLiving.getSlotForItemStack(itemStackIn) != entityequipmentslot)
{
return false;
}
}
this.inventory.setInventorySlotContents(entityequipmentslot.getIndex() + this.inventory.mainInventory.length, itemStackIn);
return true;
}
}
}
示例15: getModelTextures
private String[] getModelTextures()
{
if (this.type == 1 && this.items.length == 1)
{
Item item = Item.getItemById(this.items[0]);
boolean flag = item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION;
if (flag && this.damage != null && this.damage.getCountRanges() > 0)
{
RangeInt rangeint = this.damage.getRange(0);
int i = rangeint.getMin();
boolean flag1 = (i & 16384) != 0;
String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay");
String s6 = null;
if (flag1)
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash");
}
else
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable");
}
return new String[] {s5, s6};
}
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER)
{
String s = "leather";
String s1 = "helmet";
if (itemarmor.armorType == EntityEquipmentSlot.HEAD)
{
s1 = "helmet";
}
if (itemarmor.armorType == EntityEquipmentSlot.CHEST)
{
s1 = "chestplate";
}
if (itemarmor.armorType == EntityEquipmentSlot.LEGS)
{
s1 = "leggings";
}
if (itemarmor.armorType == EntityEquipmentSlot.FEET)
{
s1 = "boots";
}
String s2 = s + "_" + s1;
String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2);
String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay");
return new String[] {s3, s4};
}
}
}
return new String[] {this.texture};
}