Cleanup
This commit is contained in:
parent
9bf4baab49
commit
521f7d7853
2 changed files with 19 additions and 17 deletions
|
@ -92,14 +92,15 @@ public class GuiGasTank extends GuiMekanism
|
|||
{
|
||||
return idleOption;
|
||||
}
|
||||
if(dumping.equals(TileEntityGasTank.Mode.DUMPING))
|
||||
else if(dumping.equals(TileEntityGasTank.Mode.DUMPING))
|
||||
{
|
||||
return dumpingOption;
|
||||
}
|
||||
if(dumping.equals(TileEntityGasTank.Mode.DUMPING_EXCESS))
|
||||
else if(dumping.equals(TileEntityGasTank.Mode.DUMPING_EXCESS))
|
||||
{
|
||||
return dumpingExcessOption;
|
||||
}
|
||||
|
||||
return idleOption; //should not happen;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
|
@ -16,7 +17,6 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -25,8 +25,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileEntityGasTank extends TileEntityContainerBlock implements IGasHandler, ITubeConnection, IRedstoneControl
|
||||
{
|
||||
public enum Mode
|
||||
|
@ -54,6 +52,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
public TileEntityGasTank()
|
||||
{
|
||||
super("GasTank");
|
||||
|
||||
inventory = new ItemStack[2];
|
||||
dumping = Mode.IDLE;
|
||||
controlType = RedstoneControl.DISABLED;
|
||||
|
@ -101,10 +100,10 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
{
|
||||
int newGasAmount = gasTank.getStored();
|
||||
|
||||
if(newGasAmount != this.currentGasAmount)
|
||||
if(newGasAmount != currentGasAmount)
|
||||
{
|
||||
markDirty();
|
||||
this.currentGasAmount = newGasAmount;
|
||||
currentGasAmount = newGasAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +201,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
{
|
||||
gasTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt()));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
gasTank.setGas(null);
|
||||
}
|
||||
|
||||
|
@ -219,22 +217,23 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
gasTank.read(nbtTags.getCompoundTag("gasTank"));
|
||||
|
||||
if(nbtTags.hasKey("dumpingMode"))
|
||||
{
|
||||
dumping = Mode.valueOf(nbtTags.getString("dumpingMode"));
|
||||
}
|
||||
else //For backwards compatibility
|
||||
{
|
||||
else {
|
||||
boolean dumpingBool = nbtTags.getBoolean("dumping");
|
||||
|
||||
if(dumpingBool)
|
||||
{
|
||||
dumping = Mode.DUMPING;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
dumping = Mode.IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
}
|
||||
|
||||
|
@ -259,8 +258,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
data.add(gasTank.getGas().getGas().getID());
|
||||
data.add(gasTank.getStored());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
data.add(false);
|
||||
}
|
||||
|
||||
|
@ -286,7 +284,10 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
|||
{
|
||||
int stored = gasTank.getStored();
|
||||
|
||||
if(stored == 0) return 0;
|
||||
if(stored == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return MathHelper.floor_float((float)stored / (float)MAX_GAS * 14.0f + 1.0f);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue