Merge branch '1.8' of https://github.com/aidancbrady/Mekanism into 1.8
This commit is contained in:
commit
237f2cbab5
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue