private static boolean tryTakeInItemFromSlot( IHopper ihopper, IInventory iinventory, int i, int j) { ItemStack itemstack = iinventory.getItem(i); if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) { ItemStack itemstack1 = itemstack.cloneItemStack(); // CraftBukkit start - Call event on collection of items from inventories into the hopper CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); Inventory sourceInventory; // Have to special case large chests as they work oddly if (iinventory instanceof InventoryLargeChest) { sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest( (InventoryLargeChest) iinventory); } else if (isIronChest) { sourceInventory = null; } else { sourceInventory = iinventory.getOwner().getInventory(); } InventoryMoveItemEvent event = new InventoryMoveItemEvent( sourceInventory, oitemstack.clone(), ihopper.getOwner().getInventory(), false); ihopper.getWorld().getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { iinventory.setItem(i, itemstack1); if (ihopper instanceof TileEntityHopper) { ((TileEntityHopper) ihopper).c(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot } else if (ihopper instanceof EntityMinecartHopper) { ((EntityMinecartHopper) ihopper) .l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot } return false; } ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), -1); if (itemstack2 == null || itemstack2.count == 0) { if (event.getItem().equals(oitemstack)) { iinventory.update(); } else { iinventory.setItem(i, itemstack1); } // CraftBukkit end return true; } iinventory.setItem(i, itemstack1); } return false; }
public ItemStack b(int i) { ItemStack itemstack = null; Slot slot = (Slot) this.b.get(i); if (slot != null && slot.d()) { ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.cloneItemStack(); if (i == 2) { if (!this.a(itemstack1, 3, 39, true)) { return null; } slot.a(itemstack1, itemstack); } else if (i != 1 && i != 0) { if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) { if (!this.a(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityFurnace.isFuel(itemstack1)) { if (!this.a(itemstack1, 1, 2, false)) { return null; } } else if (i >= 3 && i < 30) { if (!this.a(itemstack1, 30, 39, false)) { return null; } } else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) { return null; } } else if (!this.a(itemstack1, 3, 39, false)) { return null; } if (itemstack1.count == 0) { slot.set((ItemStack) null); } else { slot.e(); } if (itemstack1.count == itemstack.count) { return null; } slot.b(itemstack1); } return itemstack; }
public void b() { for (int i = 0; i < this.c.size(); ++i) { ItemStack itemstack = ((Slot) this.c.get(i)).getItem(); ItemStack itemstack1 = (ItemStack) this.b.get(i); if (!ItemStack.matches(itemstack1, itemstack)) { itemstack1 = itemstack == null ? null : itemstack.cloneItemStack(); this.b.set(i, itemstack1); for (int j = 0; j < this.listeners.size(); ++j) { ((ICrafting) this.listeners.get(j)).a(this, i, itemstack1); } } } }
public ItemStack a(int i) { ItemStack itemstack = null; Slot slot = (Slot) this.e.get(i); if (slot != null && slot.c()) { ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.cloneItemStack(); if (i == 0) { if (!this.a(itemstack1, 10, 46, true)) { return null; } slot.a(itemstack1, itemstack); } else if (i >= 10 && i < 37) { if (!this.a(itemstack1, 37, 46, false)) { return null; } } else if (i >= 37 && i < 46) { if (!this.a(itemstack1, 10, 37, false)) { return null; } } else if (!this.a(itemstack1, 10, 46, false)) { return null; } if (itemstack1.count == 0) { slot.set((ItemStack) null); } else { slot.d(); } if (itemstack1.count == itemstack.count) { return null; } slot.c(itemstack1); } return itemstack; }
public ItemStack b(EntityHuman entityhuman, int i) { ItemStack itemstack = null; Slot slot = (Slot) this.c.get(i); if (slot != null && slot.d()) { ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.cloneItemStack(); if (i == 2) { if (!this.a(itemstack1, 3, 39, true)) { return null; } slot.a(itemstack1, itemstack); } else if (i != 0 && i != 1) { if (i >= 3 && i < 39 && !this.a(itemstack1, 0, 2, false)) { return null; } } else if (!this.a(itemstack1, 3, 39, false)) { return null; } if (itemstack1.count == 0) { slot.set((ItemStack) null); } else { slot.e(); } if (itemstack1.count == itemstack.count) { return null; } slot.a(entityhuman, itemstack1); } return itemstack; }
public void loadChest() { // CraftBukkit - private -> public InventoryHorseChest inventoryhorsechest = this.inventoryChest; this.inventoryChest = new InventoryHorseChest("HorseChest", this.cM(), this); // CraftBukkit - add this horse this.inventoryChest.a(this.getName()); if (inventoryhorsechest != null) { inventoryhorsechest.b(this); int i = Math.min(inventoryhorsechest.getSize(), this.inventoryChest.getSize()); for (int j = 0; j < i; ++j) { ItemStack itemstack = inventoryhorsechest.getItem(j); if (itemstack != null) { this.inventoryChest.setItem(j, itemstack.cloneItemStack()); } } inventoryhorsechest = null; } this.inventoryChest.a(this); this.cO(); }
public Packet103SetSlot(int i, int j, ItemStack itemstack) { this.a = i; this.b = j; this.c = itemstack == null ? itemstack : itemstack.cloneItemStack(); }
@Override public boolean a(InventoryCrafting inventorycrafting, World world) { a = null; int i = 0; int j = 0; int k = 0; int l = 0; int i1 = 0; int j1 = 0; for (int k1 = 0; k1 < inventorycrafting.getSize(); ++k1) { ItemStack itemstack = inventorycrafting.getItem(k1); if (itemstack != null) { if (itemstack.getItem() == Items.SULPHUR) { ++j; } else if (itemstack.getItem() == Items.FIREWORKS_CHARGE) { ++l; } else if (itemstack.getItem() == Items.INK_SACK) { ++k; } else if (itemstack.getItem() == Items.PAPER) { ++i; } else if (itemstack.getItem() == Items.GLOWSTONE_DUST) { ++i1; } else if (itemstack.getItem() == Items.DIAMOND) { ++i1; } else if (itemstack.getItem() == Items.FIREBALL) { ++j1; } else if (itemstack.getItem() == Items.FEATHER) { ++j1; } else if (itemstack.getItem() == Items.GOLD_NUGGET) { ++j1; } else { if (itemstack.getItem() != Items.SKULL) return false; ++j1; } } } i1 += k + j1; if (j <= 3 && i <= 1) { NBTTagCompound nbttagcompound; NBTTagCompound nbttagcompound1; if (j >= 1 && i == 1 && i1 == 0) { a = new ItemStack(Items.FIREWORKS); if (l > 0) { nbttagcompound = new NBTTagCompound(); nbttagcompound1 = new NBTTagCompound(); NBTTagList nbttaglist = new NBTTagList(); for (int l1 = 0; l1 < inventorycrafting.getSize(); ++l1) { ItemStack itemstack1 = inventorycrafting.getItem(l1); if (itemstack1 != null && itemstack1.getItem() == Items.FIREWORKS_CHARGE && itemstack1.hasTag() && itemstack1.getTag().hasKeyOfType("Explosion", 10)) { nbttaglist.add(itemstack1.getTag().getCompound("Explosion")); } } nbttagcompound1.set("Explosions", nbttaglist); nbttagcompound1.setByte("Flight", (byte) j); nbttagcompound.set("Fireworks", nbttagcompound1); a.setTag(nbttagcompound); } return true; } else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) { a = new ItemStack(Items.FIREWORKS_CHARGE); nbttagcompound = new NBTTagCompound(); nbttagcompound1 = new NBTTagCompound(); byte b0 = 0; ArrayList arraylist = new ArrayList(); for (int i2 = 0; i2 < inventorycrafting.getSize(); ++i2) { ItemStack itemstack2 = inventorycrafting.getItem(i2); if (itemstack2 != null) { if (itemstack2.getItem() == Items.INK_SACK) { arraylist.add(Integer.valueOf(ItemDye.c[itemstack2.getData()])); } else if (itemstack2.getItem() == Items.GLOWSTONE_DUST) { nbttagcompound1.setBoolean("Flicker", true); } else if (itemstack2.getItem() == Items.DIAMOND) { nbttagcompound1.setBoolean("Trail", true); } else if (itemstack2.getItem() == Items.FIREBALL) { b0 = 1; } else if (itemstack2.getItem() == Items.FEATHER) { b0 = 4; } else if (itemstack2.getItem() == Items.GOLD_NUGGET) { b0 = 2; } else if (itemstack2.getItem() == Items.SKULL) { b0 = 3; } } } int[] aint = new int[arraylist.size()]; for (int j2 = 0; j2 < aint.length; ++j2) { aint[j2] = ((Integer) arraylist.get(j2)).intValue(); } nbttagcompound1.setIntArray("Colors", aint); nbttagcompound1.setByte("Type", b0); nbttagcompound.set("Explosion", nbttagcompound1); a.setTag(nbttagcompound); return true; } else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1) { ArrayList arraylist1 = new ArrayList(); for (int k2 = 0; k2 < inventorycrafting.getSize(); ++k2) { ItemStack itemstack3 = inventorycrafting.getItem(k2); if (itemstack3 != null) { if (itemstack3.getItem() == Items.INK_SACK) { arraylist1.add(Integer.valueOf(ItemDye.c[itemstack3.getData()])); } else if (itemstack3.getItem() == Items.FIREWORKS_CHARGE) { a = itemstack3.cloneItemStack(); a.count = 1; } } } int[] aint1 = new int[arraylist1.size()]; for (int l2 = 0; l2 < aint1.length; ++l2) { aint1[l2] = ((Integer) arraylist1.get(l2)).intValue(); } if (a != null && a.hasTag()) { NBTTagCompound nbttagcompound2 = a.getTag().getCompound("Explosion"); if (nbttagcompound2 == null) return false; else { nbttagcompound2.setIntArray("FadeColors", aint1); return true; } } else return false; } else return false; } else return false; }
@Override public ItemStack a(InventoryCrafting inventorycrafting) { return a.cloneItemStack(); }
public void l_() { super.l_(); if (!this.world.isStatic) { int i = this.aU(); if (i > 0) { if (this.aw <= 0) { this.aw = 20 * (30 - i); } --this.aw; if (this.aw <= 0) { this.m(i - 1); } } for (int j = 0; j < 5; ++j) { ItemStack itemstack = this.g[j]; ItemStack itemstack1 = this.getEquipment(j); if (!ItemStack.matches(itemstack1, itemstack)) { ((WorldServer) this.world) .getTracker() .a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, j, itemstack1))); if (itemstack != null) { this.d.a(itemstack.D()); } if (itemstack1 != null) { this.d.b(itemstack1.D()); } this.g[j] = itemstack1 == null ? null : itemstack1.cloneItemStack(); } } } this.c(); double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); float f1 = this.aN; float f2 = 0.0F; this.aW = this.aX; float f3 = 0.0F; if (f > 0.0025000002F) { f3 = 1.0F; f2 = (float) Math.sqrt((double) f) * 3.0F; // CraftBukkit - Math -> TrigMath f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; } if (this.aE > 0.0F) { f1 = this.yaw; } if (!this.onGround) { f3 = 0.0F; } this.aX += (f3 - this.aX) * 0.3F; this.world.methodProfiler.a("headTurn"); f2 = this.f(f1, f2); this.world.methodProfiler.b(); this.world.methodProfiler.a("rangeChecks"); while (this.yaw - this.lastYaw < -180.0F) { this.lastYaw -= 360.0F; } while (this.yaw - this.lastYaw >= 180.0F) { this.lastYaw += 360.0F; } while (this.aN - this.aO < -180.0F) { this.aO -= 360.0F; } while (this.aN - this.aO >= 180.0F) { this.aO += 360.0F; } while (this.pitch - this.lastPitch < -180.0F) { this.lastPitch -= 360.0F; } while (this.pitch - this.lastPitch >= 180.0F) { this.lastPitch += 360.0F; } while (this.aP - this.aQ < -180.0F) { this.aQ -= 360.0F; } while (this.aP - this.aQ >= 180.0F) { this.aQ += 360.0F; } this.world.methodProfiler.b(); this.aY += f2; }
public void e() { ItemStack itemstack = this.g.getItem(0); this.a = 0; int i = 0; byte b0 = 0; int j = 0; if (itemstack == null) { this.f.setItem(0, (ItemStack) null); this.a = 0; } else { ItemStack itemstack1 = itemstack.cloneItemStack(); ItemStack itemstack2 = this.g.getItem(1); Map map = EnchantmentManager.a(itemstack1); boolean flag = false; int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost()); this.l = 0; int l; int i1; int j1; int k1; int l1; Iterator iterator; Enchantment enchantment; if (itemstack2 != null) { flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0; if (itemstack1.g() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) { l = Math.min(itemstack1.j(), itemstack1.l() / 4); if (l <= 0) { this.f.setItem(0, (ItemStack) null); this.a = 0; return; } for (i1 = 0; l > 0 && i1 < itemstack2.count; ++i1) { j1 = itemstack1.j() - l; itemstack1.setData(j1); i += Math.max(1, l / 100) + map.size(); l = Math.min(itemstack1.j(), itemstack1.l() / 4); } this.l = i1; } else { if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.g())) { this.f.setItem(0, (ItemStack) null); this.a = 0; return; } if (itemstack1.g() && !flag) { l = itemstack.l() - itemstack.j(); i1 = itemstack2.l() - itemstack2.j(); j1 = i1 + itemstack1.l() * 12 / 100; int i2 = l + j1; k1 = itemstack1.l() - i2; if (k1 < 0) { k1 = 0; } if (k1 < itemstack1.getData()) { itemstack1.setData(k1); i += Math.max(1, j1 / 100); } } Map map1 = EnchantmentManager.a(itemstack2); iterator = map1.keySet().iterator(); while (iterator.hasNext()) { j1 = ((Integer) iterator.next()).intValue(); enchantment = Enchantment.byId[j1]; k1 = map.containsKey(Integer.valueOf(j1)) ? ((Integer) map.get(Integer.valueOf(j1))).intValue() : 0; l1 = ((Integer) map1.get(Integer.valueOf(j1))).intValue(); int j2; if (k1 == l1) { ++l1; j2 = l1; } else { j2 = Math.max(l1, k1); } l1 = j2; int k2 = l1 - k1; boolean flag1 = enchantment.canEnchant(itemstack); if (this.n.abilities.canInstantlyBuild || itemstack.id == ItemEnchantedBook.ENCHANTED_BOOK.id) { flag1 = true; } Iterator iterator1 = map.keySet().iterator(); while (iterator1.hasNext()) { int l2 = ((Integer) iterator1.next()).intValue(); if (l2 != j1 && !enchantment.a(Enchantment.byId[l2])) { flag1 = false; i += k2; } } if (flag1) { if (l1 > enchantment.getMaxLevel()) { l1 = enchantment.getMaxLevel(); } map.put(Integer.valueOf(j1), Integer.valueOf(l1)); int i3 = 0; switch (enchantment.getRandomWeight()) { case 1: i3 = 8; break; case 2: i3 = 4; case 3: case 4: case 6: case 7: case 8: case 9: default: break; case 5: i3 = 2; break; case 10: i3 = 1; } if (flag) { i3 = Math.max(1, i3 / 2); } i += i3 * k2; } } } } if (this.m != null && this.m.length() > 0 && !this.m.equalsIgnoreCase(this.n.getLocale().c(itemstack.a())) && !this.m.equals(itemstack.getName())) { j = itemstack.g() ? 7 : itemstack.count * 5; i += j; if (itemstack.hasName()) { k += j / 2; } itemstack1.c(this.m); } l = 0; for (iterator = map.keySet().iterator(); iterator.hasNext(); k += l + k1 * l1) { j1 = ((Integer) iterator.next()).intValue(); enchantment = Enchantment.byId[j1]; k1 = ((Integer) map.get(Integer.valueOf(j1))).intValue(); l1 = 0; ++l; switch (enchantment.getRandomWeight()) { case 1: l1 = 8; break; case 2: l1 = 4; case 3: case 4: case 6: case 7: case 8: case 9: default: break; case 5: l1 = 2; break; case 10: l1 = 1; } if (flag) { l1 = Math.max(1, l1 / 2); } } if (flag) { k = Math.max(1, k / 2); } this.a = k + i; if (i <= 0) { itemstack1 = null; } if (j == i && j > 0 && this.a >= 40) { this.h .getLogger() .info("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); this.a = 39; } if (this.a >= 40 && !this.n.abilities.canInstantlyBuild) { itemstack1 = null; } if (itemstack1 != null) { i1 = itemstack1.getRepairCost(); if (itemstack2 != null && i1 < itemstack2.getRepairCost()) { i1 = itemstack2.getRepairCost(); } if (itemstack1.hasName()) { i1 -= 9; } if (i1 < 0) { i1 = 0; } i1 += 2; itemstack1.setRepairCost(i1); EnchantmentManager.a(map, itemstack1); } this.f.setItem(0, itemstack1); this.b(); } }
public static ItemStack b(ItemStack itemstack) { return itemstack == null ? null : itemstack.cloneItemStack(); }
protected boolean a(ItemStack itemstack, int i, int j, boolean flag) { boolean flag1 = false; int k = i; if (flag) { k = j - 1; } Slot slot; ItemStack itemstack1; if (itemstack.isStackable()) { while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) { slot = (Slot) this.c.get(k); itemstack1 = slot.getItem(); if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) { int l = itemstack1.count + itemstack.count; if (l <= itemstack.getMaxStackSize()) { itemstack.count = 0; itemstack1.count = l; slot.e(); flag1 = true; } else if (itemstack1.count < itemstack.getMaxStackSize()) { itemstack.count -= itemstack.getMaxStackSize() - itemstack1.count; itemstack1.count = itemstack.getMaxStackSize(); slot.e(); flag1 = true; } } if (flag) { --k; } else { ++k; } } } if (itemstack.count > 0) { if (flag) { k = j - 1; } else { k = i; } while (!flag && k < j || flag && k >= i) { slot = (Slot) this.c.get(k); itemstack1 = slot.getItem(); if (itemstack1 == null) { slot.set(itemstack.cloneItemStack()); slot.e(); itemstack.count = 0; flag1 = true; break; } if (flag) { --k; } else { ++k; } } } return flag1; }
public ItemStack clickItem(int i, int j, int k, EntityHuman entityhuman) { ItemStack itemstack = null; PlayerInventory playerinventory = entityhuman.inventory; Slot slot; ItemStack itemstack1; int l; ItemStack itemstack2; if ((k == 0 || k == 1) && (j == 0 || j == 1)) { if (i == -999) { if (playerinventory.getCarried() != null && i == -999) { if (j == 0) { entityhuman.drop(playerinventory.getCarried()); playerinventory.setCarried((ItemStack) null); } if (j == 1) { // CraftBukkit start - store a reference ItemStack itemstack3 = playerinventory.getCarried(); if (itemstack3.count > 0) { entityhuman.drop(itemstack3.a(1)); } if (itemstack3.count == 0) { // CraftBukkit end playerinventory.setCarried((ItemStack) null); } } } } else if (k == 1) { slot = (Slot) this.c.get(i); if (slot != null && slot.a(entityhuman)) { itemstack1 = this.b(entityhuman, i); if (itemstack1 != null) { int i1 = itemstack1.id; itemstack = itemstack1.cloneItemStack(); if (slot != null && slot.getItem() != null && slot.getItem().id == i1) { this.a(i, j, true, entityhuman); } } } } else { if (i < 0) { return null; } slot = (Slot) this.c.get(i); if (slot != null) { itemstack1 = slot.getItem(); ItemStack itemstack3 = playerinventory.getCarried(); if (itemstack1 != null) { itemstack = itemstack1.cloneItemStack(); } if (itemstack1 == null) { if (itemstack3 != null && slot.isAllowed(itemstack3)) { l = j == 0 ? itemstack3.count : 1; if (l > slot.a()) { l = slot.a(); } // CraftBukkit start if (itemstack3.count >= l) { slot.set(itemstack3.a(l)); } // CraftBukkit end if (itemstack3.count == 0) { playerinventory.setCarried((ItemStack) null); } } } else if (slot.a(entityhuman)) { if (itemstack3 == null) { l = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2; itemstack2 = slot.a(l); playerinventory.setCarried(itemstack2); if (itemstack1.count == 0) { slot.set((ItemStack) null); } slot.a(entityhuman, playerinventory.getCarried()); } else if (slot.isAllowed(itemstack3)) { if (itemstack1.id == itemstack3.id && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) { l = j == 0 ? itemstack3.count : 1; if (l > slot.a() - itemstack1.count) { l = slot.a() - itemstack1.count; } if (l > itemstack3.getMaxStackSize() - itemstack1.count) { l = itemstack3.getMaxStackSize() - itemstack1.count; } itemstack3.a(l); if (itemstack3.count == 0) { playerinventory.setCarried((ItemStack) null); } itemstack1.count += l; } else if (itemstack3.count <= slot.a()) { slot.set(itemstack3); playerinventory.setCarried(itemstack1); } } else if (itemstack1.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) { l = itemstack1.count; if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) { itemstack3.count += l; itemstack1 = slot.a(l); if (itemstack1.count == 0) { slot.set((ItemStack) null); } slot.a(entityhuman, playerinventory.getCarried()); } } } slot.e(); } } } else if (k == 2 && j >= 0 && j < 9) { slot = (Slot) this.c.get(i); if (slot.a(entityhuman)) { itemstack1 = playerinventory.getItem(j); boolean flag = itemstack1 == null || slot.inventory == playerinventory && slot.isAllowed(itemstack1); l = -1; if (!flag) { l = playerinventory.i(); flag |= l > -1; } if (slot.d() && flag) { itemstack2 = slot.getItem(); playerinventory.setItem(j, itemstack2); if ((slot.inventory != playerinventory || !slot.isAllowed(itemstack1)) && itemstack1 != null) { if (l > -1) { playerinventory.pickup(itemstack1); slot.set((ItemStack) null); slot.a(entityhuman, itemstack2); } } else { slot.set(itemstack1); slot.a(entityhuman, itemstack2); } } else if (!slot.d() && itemstack1 != null && slot.isAllowed(itemstack1)) { playerinventory.setItem(j, (ItemStack) null); slot.set(itemstack1); } } } else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) { slot = (Slot) this.c.get(i); if (slot != null && slot.d()) { itemstack1 = slot.getItem().cloneItemStack(); itemstack1.count = itemstack1.getMaxStackSize(); playerinventory.setCarried(itemstack1); } } return itemstack; }
/* */ public ItemStack a(int var1) /* */ { /* 141 */ ItemStack var2 = null; /* 142 */ Slot var3 = (Slot) this.e.get(var1); /* */ /* 144 */ if ((var3 != null) && (var3.c())) /* */ { /* 146 */ ItemStack var4 = var3.getItem(); /* 147 */ var2 = var4.cloneItemStack(); /* */ /* 149 */ if (var1 <= 18) /* */ { /* 151 */ if (!a(var4, 19, 54, true)) /* */ { /* 153 */ if (var4.count == 0) /* */ { /* 155 */ var3.set(null); /* */ } /* */ /* 158 */ return null; /* */ } /* */ } /* 161 */ else if ((var1 >= 19) && (var1 < 46)) /* */ { /* 163 */ if (EEMaps.isFuel(var4)) /* */ { /* 165 */ if (!a(var4, 0, 16, true)) /* */ { /* 167 */ if (var4.count == 0) /* */ { /* 169 */ var3.set(null); /* */ } /* */ /* 172 */ return null; /* */ } /* */ } /* 175 */ else if (!a(var4, 46, 54, false)) /* */ { /* 177 */ if (var4.count == 0) /* */ { /* 179 */ var3.set(null); /* */ } /* */ /* 182 */ return null; /* */ } /* */ } /* 185 */ else if ((var1 >= 46) && (var1 <= 54)) /* */ { /* 187 */ if ((EEMaps.isFuel(var4)) && (!a(var4, 0, 16, true))) /* */ { /* 189 */ if (var4.count == 0) /* */ { /* 191 */ var3.set(null); /* */ } /* */ /* 194 */ return null; /* */ } /* */ } /* 197 */ else if (!a(var4, 19, 54, false)) /* */ { /* 199 */ if (var4.count == 0) /* */ { /* 201 */ var3.set(null); /* */ } /* */ /* 204 */ return null; /* */ } /* */ /* 207 */ if (var4.count == 0) /* */ { /* 209 */ var3.set(null); /* */ } /* */ else /* */ { /* 213 */ var3.d(); /* */ } /* */ /* 216 */ if (var4.count == var2.count) /* */ { /* 218 */ return null; /* */ } /* */ /* 221 */ var3.c(var4); /* */ } /* */ /* 224 */ return var2; /* */ }