Finished CLR implementation of GUIs

This commit is contained in:
Aidan Brady 2014-01-31 22:28:58 -05:00
parent e84afbda9e
commit ead65e037d
3 changed files with 69 additions and 0 deletions

View file

@ -1,12 +1,17 @@
package mekanism.client.gui; package mekanism.client.gui;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.ListUtils; import mekanism.api.ListUtils;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer;
import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.inventory.container.ContainerChemicalDissolutionChamber; import mekanism.common.inventory.container.ContainerChemicalDissolutionChamber;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalDissolutionChamber;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
@ -99,6 +104,27 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism
} }
} }
@Override
protected void mouseClicked(int x, int y, int button)
{
super.mouseClicked(x, y, button);
if(button == 0)
{
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 24 && xAxis < 42 && yAxis > 56 && yAxis < 64)
{
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);
}
}
}
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas) public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas)
{ {
if(fluid == null && gas == null) if(fluid == null && gas == null)

View file

@ -1,12 +1,17 @@
package mekanism.client.gui; package mekanism.client.gui;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.ListUtils; import mekanism.api.ListUtils;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer;
import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.inventory.container.ContainerChemicalWasher; import mekanism.common.inventory.container.ContainerChemicalWasher;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.tile.TileEntityChemicalWasher;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
@ -111,6 +116,27 @@ public class GuiChemicalWasher extends GuiMekanism
} }
} }
@Override
protected void mouseClicked(int x, int y, int button)
{
super.mouseClicked(x, y, button);
if(button == 0)
{
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 45 && xAxis < 63 && yAxis > 13 && yAxis < 21)
{
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);
}
}
}
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas) public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas)
{ {
if(fluid == null && gas == null) if(fluid == null && gas == null)

View file

@ -224,6 +224,23 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
@Override @Override
public void handlePacketData(ByteArrayDataInput dataStream) public void handlePacketData(ByteArrayDataInput dataStream)
{ {
if(!worldObj.isRemote)
{
int type = dataStream.readInt();
if(type == 0)
{
inputTank.setGas(null);
}
for(EntityPlayer player : playersUsing)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), player);
}
return;
}
super.handlePacketData(dataStream); super.handlePacketData(dataStream);
isActive = dataStream.readBoolean(); isActive = dataStream.readBoolean();