public void scrollTo(float f) { int i = (itemList.size() / 8 - 5) + 1; int j = (int) ((double) (f * (float) i) + 0.5D); if (j < 0) { j = 0; } for (int k = 0; k < 9; k++) { for (int l = 0; l < 8; l++) { int i1 = l + (k + j) * 8; if (i1 >= 0 && i1 < itemList.size()) { ZooGuiContainerTradingSpecial.getInventory() .setInventorySlotContents(l + k * 8, (ItemStack) itemList.get(i1)); } else { ZooGuiContainerTradingSpecial.getInventory().setInventorySlotContents(l + k * 8, null); } } } }
public void loadStacks() { itemList = new ArrayList(); Block ablock[] = { Block.blockDiamond, Block.blockGold, Block.blockLapis, Block.blockSnow, Block.blockSteel, Block.brick, Block.cobblestoneMossy, Block.enchantmentTable, Block.jukebox, Block.blockClay }; for (int i = 0; i < ablock.length; i++) { itemList.add(new ItemStack(ablock[i])); } for (int k = 0; k < 3; k++) { itemList.add(new ItemStack(Block.leaves.blockID, 1, k)); } addBlocks(itemList); Item aitem[] = { Item.ingotGold, Item.ingotIron, Item.record11, Item.record13, Item.recordBlocks, Item.recordCat, Item.recordChirp, Item.recordFar, Item.recordMall, Item.recordMellohi, Item.recordStal, Item.recordStrad, Item.recordWard, Item.saddle }; for (int l1 = 0; l1 < aitem.length; l1++) { itemList.add(new ItemStack(aitem[l1])); } addItems(itemList); for (int i2 = 0; i2 < 3; i2++) { itemList.add(new ItemStack(mod_ZooTrade.Coin.shiftedIndex, 1, i2)); } sortGui(); InventoryPlayer inventoryplayer = minecraft.thePlayer.inventory; for (int l2 = 0; l2 < 5; l2++) { for (int k3 = 0; k3 < 8; k3++) { addSlot( new Slot( ZooGuiContainerTradingSpecial.getInventory(), k3 + l2 * 8, 8 + k3 * 18, 18 + l2 * 18)); } } for (int i3 = 0; i3 < 3; i3++) { for (int l3 = 0; l3 < 9; l3++) { addSlot(new Slot(inventoryplayer, l3 + i3 * 9 + 9, 8 + l3 * 18, 127 + i3 * 18)); } } for (int j3 = 0; j3 < 9; j3++) { addSlot(new Slot(inventoryplayer, j3, 8 + j3 * 18, 184)); } scrollTo(0.0F); }