Moved all the machines to the new way of handling the packets

This commit is contained in:
modmuss50 2015-05-30 11:14:00 +01:00
parent 0f321e2426
commit edabf79b1e
9 changed files with 33 additions and 21 deletions

View file

@ -231,7 +231,6 @@ public class RecipeCrafter {
currentTickTime = data.getInteger("currentTickTime"); currentTickTime = data.getInteger("currentTickTime");
isactive = data.getBoolean("isActive"); isactive = data.getBoolean("isActive");
System.out.println(isactive);
} }
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(NBTTagCompound tag) {

View file

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

View file

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

View file

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

View file

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

View file

@ -14,9 +14,11 @@ public class GuiAssemblingMachine extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/assembling_machine.png"); private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/assembling_machine.png");
TileAssemblingMachine assemblingmachine; TileAssemblingMachine assemblingmachine;
ContainerAssemblingMachine containerAssemblingMachine;
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) { public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) {
super(new ContainerAssemblingMachine(tileassemblinmachine, player)); super(new ContainerAssemblingMachine(tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
assemblingmachine = tileassemblinmachine; assemblingmachine = tileassemblinmachine;
@ -40,12 +42,12 @@ public class GuiAssemblingMachine extends GuiContainer {
int j = 0; int j = 0;
if(assemblingmachine.crafter.currentRecipe != null) { if(this.containerAssemblingMachine.currentTickTime != 0){
j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentRecipe.tickTime(); j = this.containerAssemblingMachine.currentTickTime * 20 / this.containerAssemblingMachine.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16); this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
j = (int)this.assemblingmachine.energy.getEnergyStored() * 12 / this.assemblingmachine.energy.getCapacity(); j = this.containerAssemblingMachine.energy * 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

@ -14,9 +14,11 @@ public class GuiChemicalReactor extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chemical_reactor.png"); private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chemical_reactor.png");
TileChemicalReactor chemicalReactor; TileChemicalReactor chemicalReactor;
ContainerChemicalReactor containerChemicalReactor;
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) { public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
super(new ContainerChemicalReactor(tilechemicalReactor, player)); super(new ContainerChemicalReactor(tilechemicalReactor, player));
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
chemicalReactor = tilechemicalReactor; chemicalReactor = tilechemicalReactor;
@ -40,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer {
int j = 0; int j = 0;
if(chemicalReactor.crafter.currentRecipe != null) { if(this.containerChemicalReactor.currentTickTime != 0){
j = this.chemicalReactor.crafter.currentTickTime * 11 / this.chemicalReactor.crafter.currentRecipe.tickTime(); j = this.containerChemicalReactor.currentTickTime * 20 / this.containerChemicalReactor.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
j = (int)this.chemicalReactor.energy.getEnergyStored() * 12 / this.chemicalReactor.energy.getCapacity(); j = this.containerChemicalReactor.energy * 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

@ -14,9 +14,11 @@ public class GuiLathe extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/lathe.png"); private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/lathe.png");
TileLathe lathe; TileLathe lathe;
ContainerLathe containerLathe;
public GuiLathe(EntityPlayer player, TileLathe tilelathe) { public GuiLathe(EntityPlayer player, TileLathe tilelathe) {
super(new ContainerLathe(tilelathe, player)); super(new ContainerLathe(tilelathe, player));
containerLathe = (ContainerLathe) this.inventorySlots;
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
lathe = tilelathe; lathe = tilelathe;
@ -40,12 +42,12 @@ public class GuiLathe extends GuiContainer {
int j = 0; int j = 0;
if(lathe.crafter.currentRecipe != null) { if(this.containerLathe.currentTickTime != 0){
j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentRecipe.tickTime(); j = this.containerLathe.currentTickTime * 20 / this.containerLathe.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16); this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16);
j = (int)this.lathe.energy.getEnergyStored() * 12 / this.lathe.energy.getCapacity(); j = this.containerLathe.energy * 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

@ -15,8 +15,11 @@ public class GuiPlateCuttingMachine extends GuiContainer {
TilePlateCuttingMachine platecuttingmachine; TilePlateCuttingMachine platecuttingmachine;
ContainerPlateCuttingMachine containerPlateCuttingMachine;
public GuiPlateCuttingMachine(EntityPlayer player, TilePlateCuttingMachine tileplatecuttingmachine) { public GuiPlateCuttingMachine(EntityPlayer player, TilePlateCuttingMachine tileplatecuttingmachine) {
super(new ContainerPlateCuttingMachine(tileplatecuttingmachine, player)); super(new ContainerPlateCuttingMachine(tileplatecuttingmachine, player));
containerPlateCuttingMachine = (ContainerPlateCuttingMachine) this.inventorySlots;
this.xSize = 176; this.xSize = 176;
this.ySize = 167; this.ySize = 167;
platecuttingmachine = tileplatecuttingmachine; platecuttingmachine = tileplatecuttingmachine;
@ -40,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer {
int j = 0; int j = 0;
if(platecuttingmachine.crafter.currentRecipe != null) { if(this.containerPlateCuttingMachine.currentTickTime != 0){
j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentRecipe.tickTime(); j = this.containerPlateCuttingMachine.currentTickTime * 20 / this.containerPlateCuttingMachine.currentNeededTicks;
} }
this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16); this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16);
j = (int)this.platecuttingmachine.energy.getEnergyStored() * 12 / this.platecuttingmachine.energy.getCapacity(); j = this.containerPlateCuttingMachine.energy * 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);
} }