You can now dump any tank by shift-clicking its gauge with a gauge dropper

This commit is contained in:
aidancbrady 2015-05-28 16:27:06 -04:00
parent b6264891f1
commit 917430bf5c
3 changed files with 26 additions and 2 deletions

View file

@ -2,6 +2,8 @@ package mekanism.client.gui.element;
import java.util.Arrays;
import org.lwjgl.input.Keyboard;
import mekanism.api.Coord4D;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.gui.GuiMekanism;
@ -60,6 +62,11 @@ public class GuiFluidGauge extends GuiGauge<Fluid>
if(index != -1)
{
if(button == 0 && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
button = 2;
}
Mekanism.packetHandler.sendToServer(new DropperUseMessage(Coord4D.get(tile), button, index));
}
}

View file

@ -2,6 +2,8 @@ package mekanism.client.gui.element;
import java.util.Arrays;
import org.lwjgl.input.Keyboard;
import mekanism.api.Coord4D;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasTank;
@ -60,6 +62,11 @@ public class GuiGasGauge extends GuiGauge<Gas>
if(index != -1)
{
if(button == 0 && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
button = 2;
}
Mekanism.packetHandler.sendToServer(new DropperUseMessage(Coord4D.get(tile), button, index));
}
}

View file

@ -51,7 +51,8 @@ public interface ITankManager
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
}
else { //Extract gas from dropper
else if(button == 1) //Extract gas from dropper
{
if(dropper.getFluid(stack) != null || gasTank.getNeeded() == 0)
{
return;
@ -63,6 +64,10 @@ public interface ITankManager
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
}
else if(button == 2) //Dump the tank
{
gasTank.setGas(null);
}
}
else if(tank instanceof FluidTank)
{
@ -87,7 +92,8 @@ public interface ITankManager
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
}
else { //Extract fluid from dropper
else if(button == 1) //Extract fluid from dropper
{
if(dropper.getGas(stack) != null || fluidTank.getCapacity()-fluidTank.getFluidAmount() == 0)
{
return;
@ -99,6 +105,10 @@ public interface ITankManager
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
}
else if(button == 2) //Dump the tank
{
fluidTank.setFluid(null);
}
}
}
}