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");
isactive = data.getBoolean("isActive");
System.out.println(isactive);
}
public void writeToNBT(NBTTagCompound tag) {

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@ import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TilePlateCuttingMachine;
public class ContainerPlateCuttingMachine extends TechRebornContainer {
public class ContainerPlateCuttingMachine extends ContainerCrafting {
EntityPlayer player;
@ -22,6 +22,7 @@ public class ContainerPlateCuttingMachine extends TechRebornContainer {
public ContainerPlateCuttingMachine(TilePlateCuttingMachine tileplatecuttingmachine,
EntityPlayer player)
{
super(tileplatecuttingmachine.crafter);
platecuttingmachine = tileplatecuttingmachine;
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");
TileAssemblingMachine assemblingmachine;
ContainerAssemblingMachine containerAssemblingMachine;
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) {
super(new ContainerAssemblingMachine(tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
assemblingmachine = tileassemblinmachine;
@ -40,12 +42,12 @@ public class GuiAssemblingMachine extends GuiContainer {
int j = 0;
if(assemblingmachine.crafter.currentRecipe != null) {
j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentRecipe.tickTime();
if(this.containerAssemblingMachine.currentTickTime != 0){
j = this.containerAssemblingMachine.currentTickTime * 20 / this.containerAssemblingMachine.currentNeededTicks;
}
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) {
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");
TileChemicalReactor chemicalReactor;
ContainerChemicalReactor containerChemicalReactor;
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
super(new ContainerChemicalReactor(tilechemicalReactor, player));
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
chemicalReactor = tilechemicalReactor;
@ -40,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer {
int j = 0;
if(chemicalReactor.crafter.currentRecipe != null) {
j = this.chemicalReactor.crafter.currentTickTime * 11 / this.chemicalReactor.crafter.currentRecipe.tickTime();
if(this.containerChemicalReactor.currentTickTime != 0){
j = this.containerChemicalReactor.currentTickTime * 20 / this.containerChemicalReactor.currentNeededTicks;
}
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) {
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");
TileLathe lathe;
ContainerLathe containerLathe;
public GuiLathe(EntityPlayer player, TileLathe tilelathe) {
super(new ContainerLathe(tilelathe, player));
containerLathe = (ContainerLathe) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
lathe = tilelathe;
@ -40,12 +42,12 @@ public class GuiLathe extends GuiContainer {
int j = 0;
if(lathe.crafter.currentRecipe != null) {
j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentRecipe.tickTime();
if(this.containerLathe.currentTickTime != 0){
j = this.containerLathe.currentTickTime * 20 / this.containerLathe.currentNeededTicks;
}
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) {
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;
ContainerPlateCuttingMachine containerPlateCuttingMachine;
public GuiPlateCuttingMachine(EntityPlayer player, TilePlateCuttingMachine tileplatecuttingmachine) {
super(new ContainerPlateCuttingMachine(tileplatecuttingmachine, player));
containerPlateCuttingMachine = (ContainerPlateCuttingMachine) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
platecuttingmachine = tileplatecuttingmachine;
@ -40,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer {
int j = 0;
if(platecuttingmachine.crafter.currentRecipe != null) {
j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentRecipe.tickTime();
if(this.containerPlateCuttingMachine.currentTickTime != 0){
j = this.containerPlateCuttingMachine.currentTickTime * 20 / this.containerPlateCuttingMachine.currentNeededTicks;
}
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) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}