mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Merge branch 'development' into 1.8.9
Huge merge with 202 conflicts, hopefully not *too* broken.
This commit is contained in:
commit
84336ec4d1
571 files changed
+10295
-4773
No files matched your search
@@ -17,13 +17,14 @@ import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -37,17 +38,14 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
public enum GasMode
|
||||
{
|
||||
IDLE,
|
||||
DUMPING,
|
||||
DUMPING_EXCESS
|
||||
DUMPING_EXCESS,
|
||||
DUMPING
|
||||
}
|
||||
|
||||
/** The type of gas stored in this tank. */
|
||||
public GasTank gasTank = new GasTank(MAX_GAS);
|
||||
|
||||
public static final int MAX_GAS = 96000;
|
||||
|
||||
/** How fast this tank can output gas. */
|
||||
public int output = 256;
|
||||
public GasTank gasTank;
|
||||
|
||||
public GasTankTier tier = GasTankTier.BASIC;
|
||||
|
||||
public GasMode dumping;
|
||||
|
||||
@@ -74,6 +72,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
configComponent.setIOConfig(TransmissionType.GAS);
|
||||
configComponent.setEjecting(TransmissionType.GAS, true);
|
||||
|
||||
gasTank = new GasTank(tier.storage);
|
||||
inventory = new ItemStack[2];
|
||||
dumping = GasMode.IDLE;
|
||||
controlType = RedstoneControl.DISABLED;
|
||||
@@ -100,19 +99,19 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
{
|
||||
if(configComponent.isEjecting(TransmissionType.GAS))
|
||||
{
|
||||
GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getStored(), output));
|
||||
GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getStored(), tier.output));
|
||||
gasTank.draw(GasTransmission.emit(toSend, this, configComponent.getSidesForData(TransmissionType.GAS, facing, 2)), true);
|
||||
}
|
||||
}
|
||||
|
||||
if(dumping == GasMode.DUMPING)
|
||||
{
|
||||
gasTank.draw(8, true);
|
||||
gasTank.draw(tier.storage/400, true);
|
||||
}
|
||||
|
||||
if(dumping == GasMode.DUMPING_EXCESS && gasTank.getNeeded() < output)
|
||||
if(dumping == GasMode.DUMPING_EXCESS && gasTank.getNeeded() < tier.output)
|
||||
{
|
||||
gasTank.draw(output-gasTank.getNeeded(), true);
|
||||
gasTank.draw(tier.output-gasTank.getNeeded(), true);
|
||||
}
|
||||
|
||||
int newGasAmount = gasTank.getStored();
|
||||
@@ -125,6 +124,12 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
currentGasAmount = newGasAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return LangUtils.localize("tile.GasTank" + tier.getBaseTier().getName() + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotID, ItemStack itemstack, EnumFacing side)
|
||||
@@ -226,6 +231,9 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
tier = GasTankTier.values()[dataStream.readInt()];
|
||||
gasTank.setMaxGas(tier.storage);
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
@@ -246,6 +254,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
tier = GasTankTier.values()[nbtTags.getInteger("tier")];
|
||||
gasTank.read(nbtTags.getCompoundTag("gasTank"));
|
||||
dumping = GasMode.values()[nbtTags.getInteger("dumping")];
|
||||
|
||||
@@ -257,6 +266,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setInteger("tier", tier.ordinal());
|
||||
nbtTags.setTag("gasTank", gasTank.write(new NBTTagCompound()));
|
||||
nbtTags.setInteger("dumping", dumping.ordinal());
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
@@ -266,6 +276,8 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
public ArrayList<Object> getNetworkedData(ArrayList<Object> data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(tier.ordinal());
|
||||
|
||||
if(gasTank.getGas() != null)
|
||||
{
|
||||
@@ -320,7 +332,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user