diff --git a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java index 62961ef2..2f7671e9 100644 --- a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java +++ b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java @@ -2,7 +2,6 @@ package tconstruct.smeltery.gui; import java.util.*; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.InventoryPlayer; @@ -34,10 +33,10 @@ public class SmelteryGui extends ActiveContainerGui { super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z)); logic = smeltery; - xSize = 248; smeltery.updateFuelDisplay(); columns = ((SmelteryContainer) this.inventorySlots).columns; + xSize = 254 + (columns - 3) * 22; // Adjust for column count } @Override @@ -63,7 +62,7 @@ public class SmelteryGui extends ActiveContainerGui boolean mouseDown = Mouse.isButtonDown(0); int lefto = this.guiLeft; int topo = this.guiTop; - int xScroll = lefto + 67; + int xScroll = lefto + 67 + (columns - 3) * 22; // Adjust for column count int yScroll = topo + 8; int scrollWidth = xScroll + 14; int scrollHeight = yScroll + 144; @@ -109,10 +108,11 @@ public class SmelteryGui extends ActiveContainerGui @Override protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY) { - fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040); - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040); + int baseX = 86 + (columns - 3) * 22; + fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), baseX, 5, 0x404040); + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), baseX + 4, (ySize - 96) + 2, 0x404040); - int cornerX = (width - xSize) / 2 + 36; + int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22; int cornerY = (height - ySize) / 2; int[] fluidHeights = calcLiquidHeights(); @@ -151,7 +151,7 @@ public class SmelteryGui extends ActiveContainerGui { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(background); - int cornerX = (width - xSize) / 2 + 36; + int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22; int cornerY = (height - ySize) / 2; drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize); diff --git a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java index 2851e058..3bce0146 100644 --- a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java +++ b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java @@ -29,29 +29,28 @@ public class SmelteryContainer extends ActiveContainer int totalSlots = smeltery.getBlockCapacity(); int y = 0; - int xleft = 2; - xleft -= 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns - for (int i = 0; i < totalSlots; i++) { int x = i % columns; - this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * columns, xleft + x * 22, 8 + y * 18, y < 8)); + this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * columns, 2 + x * 22, 8 + y * 18, y < 8)); if (x == columns - 1) y++; } + + int baseX = 90 + (columns - 3) * 22; /* Player inventory */ - for (int column = 0; column < 3; column++) + for (int row = 0; row < 3; row++) { - for (int row = 0; row < 9; row++) + for (int column = 0; column < 9; column++) { - this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 90 + row * 18, 84 + column * 18)); + this.addSlotToContainer(new Slot(inventoryplayer, column + row * 9 + 9, baseX + column * 18, 84 + row * 18)); } } for (int column = 0; column < 9; column++) { - this.addSlotToContainer(new Slot(inventoryplayer, column, 90 + column * 18, 142)); + this.addSlotToContainer(new Slot(inventoryplayer, column, baseX + column * 18, 142)); } } @@ -73,12 +72,10 @@ public class SmelteryContainer extends ActiveContainer { slot.setActive(false); } - int xleft = 2; - xleft -= 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns int xPos = (iter - basePos) % columns; int yPos = (iter - basePos) / columns; - slot.xDisplayPosition = xleft + 22 * xPos; + slot.xDisplayPosition = 2 + 22 * xPos; slot.yDisplayPosition = 8 + 18 * yPos; } return slotRow; @@ -217,7 +214,7 @@ public class SmelteryContainer extends ActiveContainer slot = (Slot) this.inventorySlots.get(slotPos); slotStack = slot.getStack(); - if (slotStack != null && ItemStack.areItemStacksEqual(slotStack, inputStack)) + if (slotStack != null && slotStack.isItemEqual(inputStack) && ItemStack.areItemStackTagsEqual(slotStack, inputStack)) { int l = slotStack.stackSize + inputStack.stackSize; diff --git a/src/main/java/tconstruct/tools/entity/ArrowEntity.java b/src/main/java/tconstruct/tools/entity/ArrowEntity.java index df62a6fa..a721182a 100644 --- a/src/main/java/tconstruct/tools/entity/ArrowEntity.java +++ b/src/main/java/tconstruct/tools/entity/ArrowEntity.java @@ -64,7 +64,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa { this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); - if(returnStack.stackSize <= 0) + if(returnStack.stackSize <= 0 || this.canBePickedUp == 2) this.setDead(); } } @@ -411,24 +411,13 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa { int stackSize; - /* - * if (par1ItemStack.isItemDamaged()) { slotID = - * this.getFirstEmptyStack(living); - * - * if (slotID >= 0) { living.setCurrentItemOrArmor(slotID, - * par1ItemStack); living.setEquipmentDropChance(slotID, 2.0f); - * par1ItemStack.stackSize = 0; return true; } else { return - * false; } } else - */ + do { - do - { - stackSize = par1ItemStack.stackSize; - par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack, living); - } while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < stackSize); + stackSize = par1ItemStack.stackSize; + par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack, living); + } while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < stackSize); - return par1ItemStack.stackSize < stackSize; - } + return par1ItemStack.stackSize < stackSize; } catch (Throwable throwable) { @@ -460,30 +449,22 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa private int storePartialItemStack (ItemStack par1ItemStack, EntityLivingBase living) { - Item i = par1ItemStack.getItem(); - int j = par1ItemStack.stackSize; + int stackSize = par1ItemStack.stackSize; int slotID; - if (par1ItemStack.getMaxStackSize() == 1) + if (!par1ItemStack.isStackable()) { slotID = this.getFirstEmptyStack(living); if (slotID < 0) { - return j; + return stackSize; } else { - /* - * if (this.mainInventory[k] == null) { this.mainInventory[k] = - * par1ItemStack; } - */ - if (living.getEquipmentInSlot(slotID) == null) - { - living.setCurrentItemOrArmor(slotID, par1ItemStack); - if (living instanceof EntityLiving) - ((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f); - } + living.setCurrentItemOrArmor(slotID, par1ItemStack.copy()); + if (living instanceof EntityLiving) + ((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f); return 0; } @@ -499,24 +480,24 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa if (slotID < 0) { - return j; + return stackSize; } else { ItemStack stack = living.getEquipmentInSlot(slotID); if (stack == null) { - living.setCurrentItemOrArmor(slotID, par1ItemStack); + living.setCurrentItemOrArmor(slotID, par1ItemStack.copy()); if (living instanceof EntityLiving) ((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f); - return par1ItemStack.stackSize; + return 0; } else { - int l = j; + int l = stackSize; - if (j > stack.getMaxStackSize() - stack.stackSize) + if (stackSize > stack.getMaxStackSize() - stack.stackSize) { l = stack.getMaxStackSize() - stack.stackSize; } @@ -528,16 +509,17 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa if (l == 0) { - return j; + return stackSize; } else { - j -= l; - stack.stackSize++; + stackSize -= l; + stack.stackSize += l; living.setCurrentItemOrArmor(slotID, stack); if (living instanceof EntityLiving) ((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f); - return j; + + return stackSize; } } } @@ -549,7 +531,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa for (int slotID = 0; slotID < 5; ++slotID) { ItemStack stack = living.getEquipmentInSlot(slotID); - if (stack != null && ItemStack.areItemStacksEqual(stack, par1ItemStack) && stack.isStackable() && stack.stackSize < stack.getMaxStackSize()) + if (stack != null && stack.isItemEqual(par1ItemStack) && ItemStack.areItemStackTagsEqual(stack, par1ItemStack) && stack.isStackable() && stack.stackSize < stack.getMaxStackSize()) { return slotID; }