Fix lots of issues

This commit is contained in:
Prospector 2016-03-28 19:47:00 -07:00
parent 620bbfc1df
commit cec54aa0c8
16 changed files with 1009 additions and 1461 deletions

View file

@ -8,66 +8,55 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileAesu;
public class ContainerAesu extends RebornContainer
{
public class ContainerAESU extends RebornContainer {
public int euOut;
public int storedEu;
public int euChange;
EntityPlayer player;
TileAesu tile;
public ContainerAesu(TileAesu tileaesu, EntityPlayer player)
{
public ContainerAESU(TileAesu tileaesu, EntityPlayer player) {
tile = tileaesu;
this.player = player;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 115 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 173));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public void detectAndSendChanges()
{
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.euOut != tile.getMaxOutput())
{
if (this.euOut != tile.getMaxOutput()) {
icrafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
}
if (this.storedEu != tile.getEnergy())
{
if (this.storedEu != tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1)
{
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
@ -76,16 +65,12 @@ public class ContainerAesu extends RebornContainer
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.euOut = value;
} else if (id == 1)
{
} else if (id == 1) {
this.storedEu = value;
} else if (id == 2)
{
} else if (id == 2) {
this.euChange = value;
}
}

View file

@ -8,8 +8,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.idsu.TileIDSU;
public class ContainerIDSU extends RebornContainer
{
public class ContainerIDSU extends RebornContainer {
public int euOut;
public int storedEu;
@ -17,58 +16,48 @@ public class ContainerIDSU extends RebornContainer
public int channel;
EntityPlayer player;
TileIDSU tile;
public ContainerIDSU(TileIDSU tileIDSU, EntityPlayer player)
{
public ContainerIDSU(TileIDSU tileIDSU, EntityPlayer player) {
tile = tileIDSU;
this.player = player;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 115 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 173));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public void detectAndSendChanges()
{
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.euOut != tile.output)
{
if (this.euOut != tile.output) {
icrafting.sendProgressBarUpdate(this, 0, tile.output);
}
if (this.storedEu != (int) tile.getEnergy())
{
if (this.storedEu != (int) tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1)
{
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.output);
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
@ -77,19 +66,14 @@ public class ContainerIDSU extends RebornContainer
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.euOut = value;
} else if (id == 1)
{
} else if (id == 1) {
this.storedEu = value;
} else if (id == 2)
{
} else if (id == 2) {
this.euChange = value;
} else if (id == 3)
{
} else if (id == 3) {
this.channel = value;
}
}

View file

@ -9,8 +9,7 @@ import reborncore.common.container.RebornContainer;
import techreborn.config.ConfigTechReborn;
import techreborn.tiles.lesu.TileLesu;
public class ContainerLesu extends RebornContainer
{
public class ContainerLESU extends RebornContainer {
public int euOut;
public int storedEu;
@ -19,8 +18,8 @@ public class ContainerLesu extends RebornContainer
public double euStorage;
EntityPlayer player;
TileLesu tile;
public ContainerLesu(TileLesu tileaesu, EntityPlayer player)
{
public ContainerLESU(TileLesu tileaesu, EntityPlayer player) {
tile = tileaesu;
this.player = player;
@ -30,55 +29,44 @@ public class ContainerLesu extends RebornContainer
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 115 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 173));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public void detectAndSendChanges()
{
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.euOut != tile.getMaxOutput())
{
if (this.euOut != tile.getMaxOutput()) {
icrafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
}
if (this.storedEu != tile.getEnergy())
{
if (this.storedEu != tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1)
{
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
if (this.connectedBlocks != tile.connectedBlocks)
{
if (this.connectedBlocks != tile.connectedBlocks) {
icrafting.sendProgressBarUpdate(this, 3, tile.connectedBlocks);
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
@ -88,22 +76,16 @@ public class ContainerLesu extends RebornContainer
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.euOut = value;
} else if (id == 1)
{
} else if (id == 1) {
this.storedEu = value;
} else if (id == 2)
{
} else if (id == 2) {
this.euChange = value;
} else if (id == 3)
{
} else if (id == 3) {
this.connectedBlocks = value;
} else if (id == 4)
{
} else if (id == 4) {
this.euStorage = value;
}
this.euStorage = ((connectedBlocks + 1) * ConfigTechReborn.LesuStoragePerBlock);