mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Creative Gas Tanks!
This commit is contained in:
1 parent
3b07db3dc0
commit
ac4148c01b
8 files changed
+42
-16
No files matched your search
@@ -49,7 +49,8 @@ public class GuiGasTank extends GuiMekanism
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
String capacityInfo = tileEntity.gasTank.getStored() + "/" + tileEntity.tier.storage;
|
||||
String stored = "" + (tileEntity.gasTank.getStored() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : tileEntity.gasTank.getStored());
|
||||
String capacityInfo = stored + " / " + (tileEntity.tier.storage == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : tileEntity.tier.storage);
|
||||
|
||||
fontRendererObj.drawString(tileEntity.getName(), (xSize / 2) - (fontRendererObj.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRendererObj.drawString(capacityInfo, 45, 40, 0x404040);
|
||||
|
||||
@@ -624,7 +624,8 @@ public final class Tier
|
||||
BASIC(64000, 256),
|
||||
ADVANCED(128000, 512),
|
||||
ELITE(256000, 1028),
|
||||
ULTIMATE(512000, 2056);
|
||||
ULTIMATE(512000, 2056),
|
||||
CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
public int storage;
|
||||
private int baseStorage;
|
||||
|
||||
@@ -121,10 +121,12 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
list.add(EnumColor.DARK_RED + LangUtils.localize("gui.empty") + ".");
|
||||
}
|
||||
else {
|
||||
list.add(EnumColor.ORANGE + gasStack.getGas().getLocalizedName() + ": " + EnumColor.GREY + gasStack.amount);
|
||||
String amount = "" + (gasStack.amount == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : gasStack.amount);
|
||||
list.add(EnumColor.ORANGE + gasStack.getGas().getLocalizedName() + ": " + EnumColor.GREY + amount);
|
||||
}
|
||||
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + GasTankTier.values()[getBaseTier(itemstack).ordinal()].storage);
|
||||
int cap = GasTankTier.values()[getBaseTier(itemstack).ordinal()].storage;
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + (cap == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : cap));
|
||||
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
@@ -193,7 +195,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
if(type.isVisible())
|
||||
{
|
||||
ItemStack filled = new ItemStack(this);
|
||||
setBaseTier(filled, BaseTier.ULTIMATE);
|
||||
setBaseTier(filled, BaseTier.CREATIVE);
|
||||
setGas(filled, new GasStack(type, ((IGasItem)filled.getItem()).getMaxGas(filled)));
|
||||
list.add(filled);
|
||||
}
|
||||
@@ -243,6 +245,12 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(getBaseTier(itemstack) == BaseTier.CREATIVE)
|
||||
{
|
||||
setGas(itemstack, new GasStack(stack.getGas(), Integer.MAX_VALUE));
|
||||
return stack.amount;
|
||||
}
|
||||
|
||||
int toUse = Math.min(getMaxGas(itemstack)-getStored(itemstack), Math.min(getRate(itemstack), stack.amount));
|
||||
setGas(itemstack, new GasStack(stack.getGas(), getStored(itemstack)+toUse));
|
||||
|
||||
|
||||
@@ -786,6 +786,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
if(getBaseTier(container) == BaseTier.CREATIVE)
|
||||
{
|
||||
setFluidStack(PipeUtils.copy(resource, Integer.MAX_VALUE), container);
|
||||
return resource.amount;
|
||||
}
|
||||
|
||||
FluidStack stored = getFluidStack(container);
|
||||
|
||||
@@ -100,31 +100,39 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
{
|
||||
if(inventory[0] != null && gasTank.getGas() != null)
|
||||
{
|
||||
gasTank.draw(GasTransmission.addGas(inventory[0], gasTank.getGas()), true);
|
||||
gasTank.draw(GasTransmission.addGas(inventory[0], gasTank.getGas()), tier != GasTankTier.CREATIVE);
|
||||
}
|
||||
|
||||
if(inventory[1] != null && (gasTank.getGas() == null || gasTank.getGas().amount < gasTank.getMaxGas()))
|
||||
{
|
||||
gasTank.receive(GasTransmission.removeGas(inventory[1], gasTank.getGasType(), gasTank.getNeeded()), true);
|
||||
|
||||
if(tier == GasTankTier.CREATIVE && gasTank.getGas() != null)
|
||||
{
|
||||
gasTank.getGas().amount = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(gasTank.getGas() != null && MekanismUtils.canFunction(this) && dumping != GasMode.DUMPING)
|
||||
if(gasTank.getGas() != null && MekanismUtils.canFunction(this) && (tier == GasTankTier.CREATIVE || dumping != GasMode.DUMPING))
|
||||
{
|
||||
if(configComponent.isEjecting(TransmissionType.GAS))
|
||||
{
|
||||
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);
|
||||
gasTank.draw(GasTransmission.emit(toSend, this, configComponent.getSidesForData(TransmissionType.GAS, facing, 2)), tier != GasTankTier.CREATIVE);
|
||||
}
|
||||
}
|
||||
|
||||
if(dumping == GasMode.DUMPING)
|
||||
if(tier != GasTankTier.CREATIVE)
|
||||
{
|
||||
gasTank.draw(tier.storage/400, true);
|
||||
}
|
||||
|
||||
if(dumping == GasMode.DUMPING_EXCESS && gasTank.getNeeded() < tier.output)
|
||||
{
|
||||
gasTank.draw(tier.output-gasTank.getNeeded(), true);
|
||||
if(dumping == GasMode.DUMPING)
|
||||
{
|
||||
gasTank.draw(tier.storage/400, true);
|
||||
}
|
||||
|
||||
if(dumping == GasMode.DUMPING_EXCESS && gasTank.getNeeded() < tier.output)
|
||||
{
|
||||
gasTank.draw(tier.output-gasTank.getNeeded(), true);
|
||||
}
|
||||
}
|
||||
|
||||
int newGasAmount = gasTank.getStored();
|
||||
@@ -209,6 +217,11 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
@Override
|
||||
public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer)
|
||||
{
|
||||
if(tier == GasTankTier.CREATIVE)
|
||||
{
|
||||
return stack != null ? stack.amount : 0;
|
||||
}
|
||||
|
||||
return gasTank.receive(stack, doTransfer);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user