public void b(ICommandListener icommandlistener, String[] astring) { if (astring.length < 2) { throw new ExceptionUsage("commands.enchant.usage", new Object[0]); } else { EntityPlayer entityplayer = d(icommandlistener, astring[0]); int i = a(icommandlistener, astring[1], 0, Enchantment.byId.length - 1); int j = 1; ItemStack itemstack = entityplayer.bx(); if (itemstack == null) { throw new CommandException("commands.enchant.noItem", new Object[0]); } else { Enchantment enchantment = Enchantment.byId[i]; if (enchantment == null) { throw new ExceptionInvalidNumber( "commands.enchant.notFound", new Object[] {Integer.valueOf(i)}); } else if (!enchantment.canEnchant(itemstack)) { throw new CommandException("commands.enchant.cantEnchant", new Object[0]); } else { if (astring.length >= 3) { j = a( icommandlistener, astring[2], enchantment.getStartLevel(), enchantment.getMaxLevel()); } if (itemstack.hasTag()) { NBTTagList nbttaglist = itemstack.getEnchantments(); if (nbttaglist != null) { for (int k = 0; k < nbttaglist.size(); ++k) { short short1 = ((NBTTagCompound) nbttaglist.get(k)).getShort("id"); if (Enchantment.byId[short1] != null) { Enchantment enchantment1 = Enchantment.byId[short1]; if (!enchantment1.a(enchantment)) { throw new CommandException( "commands.enchant.cantCombine", new Object[] { enchantment.c(j), enchantment1.c(((NBTTagCompound) nbttaglist.get(k)).getShort("lvl")) }); } } } } } itemstack.addEnchantment(enchantment, j); a(icommandlistener, "commands.enchant.success", new Object[0]); } } } }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.o(nbttagcompound.getBoolean("EatingHaystack")); this.k(nbttagcompound.getBoolean("Bred")); this.setHasChest(nbttagcompound.getBoolean("ChestedHorse")); this.m(nbttagcompound.getBoolean("HasReproduced")); this.setType(nbttagcompound.getInt("Type")); this.setVariant(nbttagcompound.getInt("Variant")); this.setTemper(nbttagcompound.getInt("Temper")); this.setTame(nbttagcompound.getBoolean("Tame")); if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) { this.setOwnerUUID(nbttagcompound.getString("OwnerUUID")); } // CraftBukkit start if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) { this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); } // CraftBukkit end AttributeInstance attributeinstance = this.bb().a("Speed"); if (attributeinstance != null) { this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D); } if (this.hasChest()) { NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.loadChest(); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 2 && j < this.inventoryChest.getSize()) { this.inventoryChest.setItem(j, ItemStack.createStack(nbttagcompound1)); } } } ItemStack itemstack; if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem")); if (itemstack != null && a(itemstack.getItem())) { this.inventoryChest.setItem(1, itemstack); } } if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem")); if (itemstack != null && itemstack.getItem() == Items.SADDLE) { this.inventoryChest.setItem(0, itemstack); } } else if (nbttagcompound.getBoolean("Saddle")) { this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE)); } this.cO(); }
public void a(NBTTagCompound nbttagcompound) { this.e = nbttagcompound.getShort("xTile"); this.f = nbttagcompound.getShort("yTile"); this.g = nbttagcompound.getShort("zTile"); this.h = nbttagcompound.getByte("inTile") & 255; this.i = nbttagcompound.getByte("inGround") == 1; // CraftBukkit start - direction -> power if (nbttagcompound.hasKey("power")) { NBTTagList nbttaglist = nbttagcompound.getList("power"); this.dirX = ((NBTTagDouble) nbttaglist.get(0)).data; this.dirY = ((NBTTagDouble) nbttaglist.get(1)).data; this.dirZ = ((NBTTagDouble) nbttaglist.get(2)).data; // CraftBukkit end } else { this.die(); } }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); if (nbttagcompound.hasKeyOfType("Processed", 9)) { NBTTagList nbttaglist = nbttagcompound.getList("Processed", 10); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); this.c.add(new ChunkCoordIntPair(nbttagcompound1.getInt("X"), nbttagcompound1.getInt("Z"))); } } }
public void a(NBTTagCompound nbttagcompound) { this.m(nbttagcompound.getFloat("AbsorptionAmount")); if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) { GenericAttributes.a( this.aX(), nbttagcompound.getList("Attributes"), this.world == null ? null : this.world.getLogger()); } if (nbttagcompound.hasKey("ActiveEffects")) { NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects"); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); MobEffect mobeffect = MobEffect.b(nbttagcompound1); this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect); } } // CraftBukkit start if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth"); if (nbtbase.getTypeId() == 5) { this.getAttributeInstance(GenericAttributes.a) .setValue((double) ((NBTTagFloat) nbtbase).data); } else if (nbtbase.getTypeId() == 3) { this.getAttributeInstance(GenericAttributes.a) .setValue((double) ((NBTTagInt) nbtbase).data); } } // CraftBukkit end if (nbttagcompound.hasKey("HealF")) { this.setHealth(nbttagcompound.getFloat("HealF")); } else { NBTBase nbtbase = nbttagcompound.get("Health"); if (nbtbase == null) { this.setHealth(this.getMaxHealth()); } else if (nbtbase.getTypeId() == 5) { this.setHealth(((NBTTagFloat) nbtbase).data); } else if (nbtbase.getTypeId() == 2) { this.setHealth((float) ((NBTTagShort) nbtbase).data); } } this.hurtTicks = nbttagcompound.getShort("HurtTime"); this.deathTicks = nbttagcompound.getShort("DeathTime"); this.attackTicks = nbttagcompound.getShort("AttackTime"); }
public void a(NBTTagList nbttaglist) { int i; for (i = 0; i < this.getSize(); ++i) { this.setItem(i, (ItemStack) null); } for (i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.getSize()) { this.setItem(j, ItemStack.createStack(nbttagcompound)); } } }
private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { if (itemstack != null) { NBTTagList nbttaglist = itemstack.getEnchantments(); if (nbttaglist != null) { for (int i = 0; i < nbttaglist.size(); ++i) { short short1 = nbttaglist.get(i).getShort("id"); short short2 = nbttaglist.get(i).getShort("lvl"); if (Enchantment.byId[short1] != null) { enchantmentmodifier.a(Enchantment.byId[short1], short2); } } } } }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { this.items[b0] = ItemStack.a(nbttagcompound1); } } this.brewTime = nbttagcompound.getShort("BrewTime"); }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.items = new ItemStack[this.getSize()]; if (nbttagcompound.hasKeyOfType("CustomName", 8)) { this.p = nbttagcompound.getString("CustomName"); } for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { this.items[j] = ItemStack.createStack(nbttagcompound1); } } }
public static Map a(ItemStack itemstack) { LinkedHashMap linkedhashmap = new LinkedHashMap(); NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.g(itemstack) : itemstack.getEnchantments(); if (nbttaglist != null) { for (int i = 0; i < nbttaglist.size(); ++i) { short short1 = nbttaglist.get(i).getShort("id"); short short2 = nbttaglist.get(i).getShort("lvl"); linkedhashmap.put(Integer.valueOf(short1), Integer.valueOf(short2)); } } return linkedhashmap; }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.a = new ItemStack[this.getSize()]; if (nbttagcompound.hasKeyOfType("CustomName", 8)) { this.i = nbttagcompound.getString("CustomName"); } this.j = nbttagcompound.getInt("TransferCooldown"); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.a.length) { this.a[b0] = ItemStack.createStack(nbttagcompound1); } } }
protected void a(NBTTagCompound nbttagcompound) { this.type = nbttagcompound.getInt("Type"); if (this.type == 2) { this.b = nbttagcompound.getDouble("PushX"); this.c = nbttagcompound.getDouble("PushZ"); this.e = nbttagcompound.getShort("Fuel"); } else if (this.type == 1) { NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { this.items[j] = ItemStack.a(nbttagcompound1); } } } }
public static int getEnchantmentLevel(int i, ItemStack itemstack) { if (itemstack == null) { return 0; } else { NBTTagList nbttaglist = itemstack.getEnchantments(); if (nbttaglist == null) { return 0; } else { for (int j = 0; j < nbttaglist.size(); ++j) { short short1 = nbttaglist.get(j).getShort("id"); short short2 = nbttaglist.get(j).getShort("lvl"); if (short1 == i) { return short2; } } return 0; } } }
public static boolean a(NBTTagCompound paramNBTTagCompound) { if (paramNBTTagCompound == null) { return false; } if (!paramNBTTagCompound.hasKey("pages")) { return false; } NBTTagList localNBTTagList = (NBTTagList) paramNBTTagCompound.get("pages"); for (int i = 0; i < localNBTTagList.size(); i++) { NBTTagString localNBTTagString = (NBTTagString) localNBTTagList.get(i); if (localNBTTagString.data == null) { return false; } if (localNBTTagString.data.length() > 256) { return false; } } return true; }
public void a(NBTTagCompound nbttagcompound) { this.m(nbttagcompound.getFloat("AbsorptionAmount")); if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isStatic) { GenericAttributes.a(this.bc(), nbttagcompound.getList("Attributes", 10)); } if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) { NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects", 10); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); MobEffect mobeffect = MobEffect.b(nbttagcompound1); if (mobeffect != null) { this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect); } } } if (nbttagcompound.hasKeyOfType("HealF", 99)) { this.setHealth(nbttagcompound.getFloat("HealF")); } else { NBTBase nbtbase = nbttagcompound.get("Health"); if (nbtbase == null) { this.setHealth(this.getMaxHealth()); } else if (nbtbase.getTypeId() == 5) { this.setHealth(((NBTTagFloat) nbtbase).h()); } else if (nbtbase.getTypeId() == 2) { this.setHealth((float) ((NBTTagShort) nbtbase).e()); } } this.hurtTicks = nbttagcompound.getShort("HurtTime"); this.deathTicks = nbttagcompound.getShort("DeathTime"); this.attackTicks = nbttagcompound.getShort("AttackTime"); }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.items = new ItemStack[this.getSize()]; for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { this.items[b0] = ItemStack.createStack(nbttagcompound1); } } this.burnTime = nbttagcompound.getShort("BurnTime"); this.cookTime = nbttagcompound.getShort("CookTime"); this.ticksForCurrentFuel = fuelTime(this.items[1]); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { this.o = nbttagcompound.getString("CustomName"); } }
public Multimap B() { Object object; if (this.hasTag() && this.tag.hasKeyOfType("AttributeModifiers", 9)) { object = HashMultimap.create(); NBTTagList nbttaglist = this.tag.getList("AttributeModifiers", 10); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.get(i); AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound); if (attributemodifier != null && attributemodifier.a().getLeastSignificantBits() != 0L && attributemodifier.a().getMostSignificantBits() != 0L) { ((Multimap) object).put(nbttagcompound.getString("AttributeName"), attributemodifier); } } } else { object = this.getItem().i(); } return (Multimap) object; }