Now sync to the client side tile, not the container.

This commit is contained in:
modmuss50 2015-05-31 10:45:08 +01:00
parent 17ed2d163d
commit 1e656b26e7
9 changed files with 25 additions and 20 deletions

View file

@ -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 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])) { if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) {
canGiveInvAll = false; canGiveInvAll = false;
break;
} }
} }
if (canGiveInvAll) { if (canGiveInvAll) {

View file

@ -5,7 +5,7 @@ import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput; import techreborn.client.SlotOutput;
import techreborn.tiles.TileAlloySmelter; import techreborn.tiles.TileAlloySmelter;
public class ContainerAlloySmelter extends TechRebornContainer { public class ContainerAlloySmelter extends ContainerCrafting {
EntityPlayer player; EntityPlayer player;
@ -22,6 +22,7 @@ public class ContainerAlloySmelter extends TechRebornContainer {
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter, public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter,
EntityPlayer player) EntityPlayer player)
{ {
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter; tile = tileAlloysmelter;
this.player = player; this.player = player;

View file

@ -9,9 +9,9 @@ public abstract class ContainerCrafting extends TechRebornContainer {
RecipeCrafter crafter; RecipeCrafter crafter;
public int currentTickTime = 0; int currentTickTime = 0;
public int currentNeededTicks = 0; int currentNeededTicks = 0;
public int energy; int energy;
public ContainerCrafting(RecipeCrafter crafter) { public ContainerCrafting(RecipeCrafter crafter) {
this.crafter = crafter; this.crafter = crafter;
@ -52,5 +52,8 @@ public abstract class ContainerCrafting extends TechRebornContainer {
} else if(id == 2){ } else if(id == 2){
this.energy = value; this.energy = value;
} }
this.crafter.currentTickTime = currentTickTime;
this.crafter.currentNeededTicks = currentNeededTicks;
this.crafter.energy.setEnergyStored(energy);
} }
} }

View file

@ -40,7 +40,7 @@ public class GuiAlloySmelter extends GuiContainer {
int j = 0; int j = 0;
if(alloysmelter.crafter.currentRecipe != null) { if(alloysmelter.crafter.currentTickTime != 0) {
j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks; j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);

View file

@ -42,12 +42,12 @@ public class GuiAssemblingMachine extends GuiContainer {
int j = 0; int j = 0;
if(this.containerAssemblingMachine.currentTickTime != 0){ if(this.assemblingmachine.crafter.currentTickTime != 0){
j = this.containerAssemblingMachine.currentTickTime * 20 / this.containerAssemblingMachine.currentNeededTicks; j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16); 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) { if(j > 0) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
} }

View file

@ -42,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer {
int j = 0; int j = 0;
if(this.containerChemicalReactor.currentTickTime != 0){ if(this.chemicalReactor.crafter.currentTickTime != 0){
j = this.containerChemicalReactor.currentTickTime * 20 / this.containerChemicalReactor.currentNeededTicks; j = this.chemicalReactor.crafter.currentTickTime * 20 / this.chemicalReactor.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); 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) { if(j > 0) {
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
} }

View file

@ -42,13 +42,13 @@ public class GuiImplosionCompressor extends GuiContainer{
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0; int j = 0;
if(this.containerImplosionCompressor.currentTickTime != 0){ if(this.compresser.crafter.currentTickTime != 0){
j = this.containerImplosionCompressor.currentTickTime * 20 / this.containerImplosionCompressor.currentNeededTicks; j = this.compresser.crafter.currentTickTime * 20 / this.compresser.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16); 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) { if(j > 0) {
this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2); this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2);
} }

View file

@ -42,12 +42,12 @@ public class GuiLathe extends GuiContainer {
int j = 0; int j = 0;
if(this.containerLathe.currentTickTime != 0){ if(this.lathe.crafter.currentTickTime != 0){
j = this.containerLathe.currentTickTime * 20 / this.containerLathe.currentNeededTicks; j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16); 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) { if(j > 0) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
} }

View file

@ -43,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer {
int j = 0; int j = 0;
if(this.containerPlateCuttingMachine.currentTickTime != 0){ if(this.platecuttingmachine.crafter.currentTickTime != 0){
j = this.containerPlateCuttingMachine.currentTickTime * 20 / this.containerPlateCuttingMachine.currentNeededTicks; j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16); 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) { if(j > 0) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
} }