Just about finished Salination Plant multiblock stuff

This commit is contained in:
Aidan C. Brady 2014-01-14 21:29:46 -05:00
parent 514225180b
commit ae5fe1cfbf
4 changed files with 32 additions and 17 deletions

View file

@ -33,7 +33,6 @@ public class GuiSalinationController extends GuiMekanism
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
fontRenderer.drawString(tileEntity.getInvName(), 5, 5, 0x404040);
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
fontRenderer.drawString("Structure: " + (tileEntity.structured ? MekanismUtils.localize("gui.on") : MekanismUtils.localize("gui.off")), 50, 21, 0x00CD00);
@ -108,6 +107,14 @@ public class GuiSalinationController extends GuiMekanism
displayInt = tileEntity.getScaledTempLevel(78);
drawTexturedModalRect(guiWidth + 49, guiHeight + 64, 176, 59, displayInt, 8);
if(xAxis >= 48 && xAxis <= 128 && yAxis >= 5 && yAxis <= 17)
{
drawTexturedModalRect(guiWidth + 48, guiHeight + 5, 176, 79, 80, 12);
}
else {
drawTexturedModalRect(guiWidth + 48, guiHeight + 5, 176, 67, 80, 12);
}
}
@Override
@ -120,19 +127,11 @@ public class GuiSalinationController extends GuiMekanism
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 44 && xAxis < 62 && yAxis > 13 && yAxis < 21)
if(xAxis >= 48 && xAxis <= 128 && yAxis >= 5 && yAxis <= 17)
{
ArrayList data = new ArrayList();
data.add(0);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
else if(xAxis > 114 && xAxis < 132 && yAxis > 13 && yAxis < 21)
{
ArrayList data = new ArrayList();
data.add(1);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}

View file

@ -74,7 +74,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
if(ticker == 5 && cacheStructure)
{
refresh();
refresh(true);
cacheStructure = false;
}
@ -110,7 +110,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
{
super.onChunkUnload();
refresh();
refresh(false);
}
@Override
@ -118,14 +118,14 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
{
super.onNeighborChange(id);
refresh();
refresh(false);
}
protected void refresh()
protected void refresh(boolean canCreate)
{
if(!worldObj.isRemote)
{
if(structured && !updatedThisTick)
if((structured || canCreate) && !updatedThisTick)
{
boolean prev = structured;
@ -491,6 +491,18 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
@Override
public void handlePacketData(ByteArrayDataInput dataStream)
{
if(!worldObj.isRemote)
{
int type = dataStream.readInt();
if(type == 0)
{
refresh(true);
}
return;
}
super.handlePacketData(dataStream);
if(dataStream.readBoolean())
@ -582,6 +594,8 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
waterTank.readFromNBT(nbtTags.getCompoundTag("waterTank"));
brineTank.readFromNBT(nbtTags.getCompoundTag("brineTank"));
temperature = nbtTags.getFloat("temperature");
partialWater = nbtTags.getDouble("partialWater");
partialBrine = nbtTags.getDouble("partialBrine");
@ -596,6 +610,8 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
nbtTags.setCompoundTag("waterTank", waterTank.writeToNBT(new NBTTagCompound()));
nbtTags.setCompoundTag("brineTank", brineTank.writeToNBT(new NBTTagCompound()));
nbtTags.setFloat("temperature", temperature);
nbtTags.setDouble("partialWater", partialWater);
nbtTags.setDouble("partialBrine", partialBrine);

View file

@ -41,7 +41,7 @@ public class TileEntitySalinationTank extends TileEntityContainerBlock
if(master != null)
{
master.refresh();
master.refresh(false);
}
}
@ -52,7 +52,7 @@ public class TileEntitySalinationTank extends TileEntityContainerBlock
if(master != null)
{
master.refresh();
master.refresh(false);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB