diff --git a/src/main/java/mekanism/api/gas/GasTank.java b/src/main/java/mekanism/api/gas/GasTank.java index 7ab4e4f2e..1e2aeb944 100644 --- a/src/main/java/mekanism/api/gas/GasTank.java +++ b/src/main/java/mekanism/api/gas/GasTank.java @@ -163,6 +163,14 @@ public class GasTank return maxGas; } + /** + * Sets the maximum amount of gas this tank can hold + */ + public void setMaxGas(int capacity) + { + maxGas = capacity; + } + /** * Gets the GasStack held by this GasTank. * @return - GasStakc held by this tank diff --git a/src/main/java/mekanism/client/gui/GuiEntangledBlock.java b/src/main/java/mekanism/client/gui/GuiEntangledBlock.java index f56835613..0b2043e7b 100644 --- a/src/main/java/mekanism/client/gui/GuiEntangledBlock.java +++ b/src/main/java/mekanism/client/gui/GuiEntangledBlock.java @@ -32,10 +32,13 @@ public class GuiEntangledBlock extends GuiMekanism public GuiTextField frequencyField; + public boolean isCreative; + public GuiEntangledBlock(InventoryPlayer inventory, TileEntityEntangledBlock tentity) { super(new ContainerNull(inventory.player, tentity)); tileEntity = tentity; + isCreative = inventory.player.capabilities.isCreativeMode; } @Override @@ -108,7 +111,10 @@ public class GuiEntangledBlock extends GuiMekanism data.add(0); data.add(toUse); - Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); + if(!toUse.startsWith("creative.") || isCreative) + { + Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); + } frequencyField.setText(""); } @@ -125,7 +131,6 @@ public class GuiEntangledBlock extends GuiMekanism String prevFreq = frequencyField != null ? frequencyField.getText() : ""; frequencyField = new GuiTextField(fontRendererObj, guiWidth + 75, guiHeight + 55, 96, 11); - frequencyField.setMaxStringLength(10); frequencyField.setText(prevFreq); } } diff --git a/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java b/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java index 99c7c209f..fb55388ba 100644 --- a/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java +++ b/src/main/java/mekanism/common/teleportation/SharedInventoryManager.java @@ -1,6 +1,15 @@ package mekanism.common.teleportation; +import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; + +import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; + +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidRegistry.FluidRegisterEvent; +import net.minecraftforge.fluids.FluidStack; public class SharedInventoryManager { @@ -22,6 +31,38 @@ public class SharedInventoryManager inventories.put(frequency, inv); } + if(frequency.startsWith("creative.")) + { + Iterator creativeFreqs = Arrays.asList(frequency.substring(9).split("\\.")).iterator(); + while(creativeFreqs.hasNext()) + { + String type = creativeFreqs.next(); + if(type.equals("energy")) + { + inv.MAX_ENERGY = Integer.MAX_VALUE; + inv.setEnergy(Integer.MAX_VALUE); + } + else if(type.equals("fluid") && creativeFreqs.hasNext()) + { + String fluidType = creativeFreqs.next(); + if(FluidRegistry.isFluidRegistered(fluidType)) + { + inv.storedFluid.setCapacity(Integer.MAX_VALUE); + inv.storedFluid.setFluid(new FluidStack(FluidRegistry.getFluid(fluidType), Integer.MAX_VALUE)); + } + } + else if(type.equals("gas") && creativeFreqs.hasNext()) + { + String gasType = creativeFreqs.next(); + if(GasRegistry.containsGas(gasType)) + { + inv.storedGas.setMaxGas(Integer.MAX_VALUE); + inv.storedGas.setGas(new GasStack(GasRegistry.getGas(gasType), Integer.MAX_VALUE)); + } + } + } + } + return inv; } }