From 1e656b26e70973ef0be0543f8ed5d70d89728e3d Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 31 May 2015 10:45:08 +0100 Subject: [PATCH] Now sync to the client side tile, not the container. --- src/main/java/techreborn/api/recipe/RecipeCrafter.java | 1 + .../client/container/ContainerAlloySmelter.java | 3 ++- .../techreborn/client/container/ContainerCrafting.java | 9 ++++++--- src/main/java/techreborn/client/gui/GuiAlloySmelter.java | 2 +- .../java/techreborn/client/gui/GuiAssemblingMachine.java | 6 +++--- .../java/techreborn/client/gui/GuiChemicalReactor.java | 6 +++--- .../techreborn/client/gui/GuiImplosionCompressor.java | 6 +++--- src/main/java/techreborn/client/gui/GuiLathe.java | 6 +++--- .../techreborn/client/gui/GuiPlateCuttingMachine.java | 6 +++--- 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/main/java/techreborn/api/recipe/RecipeCrafter.java b/src/main/java/techreborn/api/recipe/RecipeCrafter.java index 92fd425f1..4a2b1061f 100644 --- a/src/main/java/techreborn/api/recipe/RecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/RecipeCrafter.java @@ -117,6 +117,7 @@ public class RecipeCrafter { for (int i = 0; i < recipe.getOutputs().size(); i++) {//This checks to see if it can fit all of the outputs if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) { canGiveInvAll = false; + break; } } if (canGiveInvAll) { diff --git a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java index 50d964364..207a2dbb6 100644 --- a/src/main/java/techreborn/client/container/ContainerAlloySmelter.java +++ b/src/main/java/techreborn/client/container/ContainerAlloySmelter.java @@ -5,7 +5,7 @@ import net.minecraft.inventory.Slot; import techreborn.client.SlotOutput; import techreborn.tiles.TileAlloySmelter; -public class ContainerAlloySmelter extends TechRebornContainer { +public class ContainerAlloySmelter extends ContainerCrafting { EntityPlayer player; @@ -22,6 +22,7 @@ public class ContainerAlloySmelter extends TechRebornContainer { public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter, EntityPlayer player) { + super(tileAlloysmelter.crafter); tile = tileAlloysmelter; this.player = player; diff --git a/src/main/java/techreborn/client/container/ContainerCrafting.java b/src/main/java/techreborn/client/container/ContainerCrafting.java index 22007340a..c9a3ed037 100644 --- a/src/main/java/techreborn/client/container/ContainerCrafting.java +++ b/src/main/java/techreborn/client/container/ContainerCrafting.java @@ -9,9 +9,9 @@ public abstract class ContainerCrafting extends TechRebornContainer { RecipeCrafter crafter; - public int currentTickTime = 0; - public int currentNeededTicks = 0; - public int energy; + int currentTickTime = 0; + int currentNeededTicks = 0; + int energy; public ContainerCrafting(RecipeCrafter crafter) { this.crafter = crafter; @@ -52,5 +52,8 @@ public abstract class ContainerCrafting extends TechRebornContainer { } else if(id == 2){ this.energy = value; } + this.crafter.currentTickTime = currentTickTime; + this.crafter.currentNeededTicks = currentNeededTicks; + this.crafter.energy.setEnergyStored(energy); } } diff --git a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java index 4674bea7c..4c755e090 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java +++ b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java @@ -40,7 +40,7 @@ public class GuiAlloySmelter extends GuiContainer { int j = 0; - if(alloysmelter.crafter.currentRecipe != null) { + if(alloysmelter.crafter.currentTickTime != 0) { j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16); diff --git a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java index 65bd9d716..2d8123d68 100644 --- a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java @@ -42,12 +42,12 @@ public class GuiAssemblingMachine extends GuiContainer { int j = 0; - if(this.containerAssemblingMachine.currentTickTime != 0){ - j = this.containerAssemblingMachine.currentTickTime * 20 / this.containerAssemblingMachine.currentNeededTicks; + if(this.assemblingmachine.crafter.currentTickTime != 0){ + j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16); - j = this.containerAssemblingMachine.energy * 12 / this.assemblingmachine.energy.getCapacity(); + j = (int) (this.assemblingmachine.energy.getEnergyStored() * 12 / this.assemblingmachine.energy.getCapacity()); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java index 7aecf2349..ed583da5f 100644 --- a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java +++ b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java @@ -42,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer { int j = 0; - if(this.containerChemicalReactor.currentTickTime != 0){ - j = this.containerChemicalReactor.currentTickTime * 20 / this.containerChemicalReactor.currentNeededTicks; + if(this.chemicalReactor.crafter.currentTickTime != 0){ + j = this.chemicalReactor.crafter.currentTickTime * 20 / this.chemicalReactor.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); - j = this.containerChemicalReactor.energy * 12 / this.chemicalReactor.energy.getCapacity(); + j = (int) (this.chemicalReactor.crafter.energy.getEnergyStored() * 12 / this.chemicalReactor.energy.getCapacity()); if(j > 0) { this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java index 7aa95d0ed..88b5d2351 100644 --- a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -42,13 +42,13 @@ public class GuiImplosionCompressor extends GuiContainer{ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int j = 0; - if(this.containerImplosionCompressor.currentTickTime != 0){ - j = this.containerImplosionCompressor.currentTickTime * 20 / this.containerImplosionCompressor.currentNeededTicks; + if(this.compresser.crafter.currentTickTime != 0){ + j = this.compresser.crafter.currentTickTime * 20 / this.compresser.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16); - j = this.containerImplosionCompressor.energy * 12 / this.compresser.energy.getCapacity(); + j = (int) (this.compresser.crafter.energy.getEnergyStored() * 12 / this.compresser.energy.getCapacity()); if(j > 0) { this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiLathe.java b/src/main/java/techreborn/client/gui/GuiLathe.java index a62d73bd3..a9a96edb6 100644 --- a/src/main/java/techreborn/client/gui/GuiLathe.java +++ b/src/main/java/techreborn/client/gui/GuiLathe.java @@ -42,12 +42,12 @@ public class GuiLathe extends GuiContainer { int j = 0; - if(this.containerLathe.currentTickTime != 0){ - j = this.containerLathe.currentTickTime * 20 / this.containerLathe.currentNeededTicks; + if(this.lathe.crafter.currentTickTime != 0){ + j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16); - j = this.containerLathe.energy * 12 / this.lathe.energy.getCapacity(); + j = (int) (this.lathe.energy.getEnergyStored() * 12 / this.lathe.energy.getCapacity()); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java b/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java index 2d43b2228..ebe8768e8 100644 --- a/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java @@ -43,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer { int j = 0; - if(this.containerPlateCuttingMachine.currentTickTime != 0){ - j = this.containerPlateCuttingMachine.currentTickTime * 20 / this.containerPlateCuttingMachine.currentNeededTicks; + if(this.platecuttingmachine.crafter.currentTickTime != 0){ + j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentNeededTicks; } this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16); - j = this.containerPlateCuttingMachine.energy * 12 / this.platecuttingmachine.energy.getCapacity(); + j = (int) (this.platecuttingmachine.energy.getEnergyStored() * 12 / this.platecuttingmachine.energy.getCapacity()); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); }