Gas tanks can now dump gasses
This commit is contained in:
parent
9b1c605131
commit
c6cb70c9da
6 changed files with 65 additions and 2 deletions
|
@ -155,7 +155,7 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
fontRenderer.drawString(tileEntity.getInvName(), 69, 6, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
fontRenderer.drawString(tileEntity.running ? MekanismUtils.localize("gui.digitalMiner.running") : MekanismUtils.localize("gui.digitalMiner.idle"), 9, 10, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.running ? MekanismUtils.localize("gui.digitalMiner.running") : MekanismUtils.localize("gui.idle"), 9, 10, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.searcher.state.desc, 9, 19, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(MekanismUtils.localize("gui.eject") + ": " + MekanismUtils.localize("gui." + (tileEntity.doEject ? "on" : "off")), 9, 30, 0x00CD00);
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerGasTank;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
@ -37,6 +43,9 @@ public class GuiGasTank extends GuiMekanism
|
|||
fontRenderer.drawString("Gas: " + (tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() : "None"), 45, 49, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
|
||||
String name = tileEntity.dumping ? "Dumping..." : MekanismUtils.localize("gui.idle");
|
||||
fontRenderer.drawString(name, 156-fontRenderer.getStringWidth(name), 73, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
@ -51,10 +60,32 @@ public class GuiGasTank extends GuiMekanism
|
|||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int displayInt = tileEntity.dumping ? 18 : 10;
|
||||
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, displayInt, 8, 8);
|
||||
|
||||
if(tileEntity.gasTank.getGas() != null)
|
||||
{
|
||||
int scale = (int)(((double)tileEntity.gasTank.getStored() / tileEntity.MAX_GAS) * 72);
|
||||
drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button)
|
||||
{
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
|
||||
if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,11 @@ import mekanism.api.gas.IGasHandler;
|
|||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -30,6 +34,8 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
/** How fast this tank can output gas. */
|
||||
public int output = 16;
|
||||
|
||||
public boolean dumping;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
public RedstoneControl controlType;
|
||||
|
||||
|
@ -68,6 +74,11 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote && dumping)
|
||||
{
|
||||
gasTank.draw(8, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,6 +150,23 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
int type = dataStream.readInt();
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
dumping = !dumping;
|
||||
}
|
||||
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), player);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
|
@ -149,6 +177,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
gasTank.setGas(null);
|
||||
}
|
||||
|
||||
dumping = dataStream.readBoolean();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
|
@ -160,6 +189,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
gasTank.read(nbtTags.getCompoundTag("gasTank"));
|
||||
dumping = nbtTags.getBoolean("dumping");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
}
|
||||
|
||||
|
@ -169,6 +199,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setCompoundTag("gasTank", gasTank.write(new NBTTagCompound()));
|
||||
nbtTags.setBoolean("dumping", dumping);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
}
|
||||
|
||||
|
@ -187,6 +218,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
data.add(false);
|
||||
}
|
||||
|
||||
data.add(dumping);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
return data;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.7 KiB |
|
@ -264,6 +264,7 @@ gui.state=State
|
|||
gui.on=On
|
||||
gui.off=Off
|
||||
gui.filters=Filters
|
||||
gui.idle=Idle
|
||||
|
||||
gui.chemicalInfuser.short=C. Infuser
|
||||
gui.chemicalCombiner.short=C. Combiner
|
||||
|
@ -338,7 +339,6 @@ gui.digitalMiner.pull=Pull
|
|||
gui.digitalMiner.silk=Silk
|
||||
gui.digitalMiner.toMine=To mine
|
||||
gui.digitalMiner.running=Running
|
||||
gui.digitalMiner.idle=Idle
|
||||
gui.digitalMiner.inverse=Inverse mode
|
||||
|
||||
//Item and block tooltip text
|
||||
|
|
Loading…
Reference in a new issue