Added remaining framework for gas/fluid tank handling, finished new configuration implementation for PRC and Chemical Injection Chamber
This commit is contained in:
parent
18e23bb74c
commit
93df96851a
25 changed files with 173 additions and 80 deletions
|
@ -7,7 +7,6 @@ import java.util.Set;
|
|||
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
|
@ -75,23 +74,6 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
|
|||
|
||||
if(tileEntity instanceof ISideConfiguration)
|
||||
{
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
if(element instanceof GuiGauge)
|
||||
{
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
if(element.getBounds(guiWidth, guiHeight).contains(xAxis, yAxis))
|
||||
{
|
||||
if(((GuiGauge)element).color != null)
|
||||
{
|
||||
drawCreativeTabHoveringText(((GuiGauge)element).color.getName(), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Slot hovering = null;
|
||||
|
||||
for(int i = 0; i < inventorySlots.inventorySlots.size(); i++)
|
||||
|
|
|
@ -55,28 +55,28 @@ public class GuiPRC extends GuiMekanism
|
|||
String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_PER_TICK + extra));
|
||||
return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}
|
||||
}, this, tileEntity.guiLocation));
|
||||
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {
|
||||
@Override
|
||||
public FluidTank getTank()
|
||||
{
|
||||
return tileEntity.inputFluidTank;
|
||||
}
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 5, 10));
|
||||
}, GuiGauge.Type.STANDARD_YELLOW, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 5, 10));
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
public GasTank getTank()
|
||||
{
|
||||
return tileEntity.inputGasTank;
|
||||
}
|
||||
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 28, 10));
|
||||
}, GuiGauge.Type.STANDARD_RED, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 28, 10));
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
@Override
|
||||
public GasTank getTank()
|
||||
{
|
||||
return tileEntity.outputGasTank;
|
||||
}
|
||||
}, GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 140, 40));
|
||||
}, GuiGauge.Type.SMALL_BLUE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 140, 40));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15));
|
||||
|
||||
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 53, 34));
|
||||
|
|
|
@ -178,7 +178,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
drawCreativeTabHoveringText(data.color != null ? data.color.getName() : MekanismUtils.localize("gui.none"), xAxis, yAxis);
|
||||
drawCreativeTabHoveringText(data.color + data.localize() + " (" + data.color.getName() + ")", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -24,6 +25,12 @@ public class GuiEnergyGauge extends GuiGauge
|
|||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmission()
|
||||
{
|
||||
return TransmissionType.ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScaledLevel()
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.item.ItemGaugeDropper;
|
||||
import mekanism.common.network.PacketDropperUse.DropperUseMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
|
@ -36,6 +37,12 @@ public class GuiFluidGauge extends GuiGauge<Fluid>
|
|||
return gauge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmission()
|
||||
{
|
||||
return TransmissionType.FLUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
|
@ -47,9 +54,9 @@ public class GuiFluidGauge extends GuiGauge<Fluid>
|
|||
{
|
||||
TileEntity tile = ((GuiMekanism)guiObj).getTileEntity();
|
||||
|
||||
if(tile instanceof IDropperHandler)
|
||||
if(tile instanceof ITankManager)
|
||||
{
|
||||
int index = Arrays.asList(((IDropperHandler)tile).getTanks()).indexOf(infoHandler.getTank());
|
||||
int index = Arrays.asList(((ITankManager)tile).getTanks()).indexOf(infoHandler.getTank());
|
||||
|
||||
if(index != -1)
|
||||
{
|
||||
|
|
|
@ -5,10 +5,11 @@ import java.util.Arrays;
|
|||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.item.ItemGaugeDropper;
|
||||
import mekanism.common.network.PacketDropperUse.DropperUseMessage;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -36,6 +37,12 @@ public class GuiGasGauge extends GuiGauge<Gas>
|
|||
return gauge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmission()
|
||||
{
|
||||
return TransmissionType.GAS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
|
@ -47,9 +54,9 @@ public class GuiGasGauge extends GuiGauge<Gas>
|
|||
{
|
||||
TileEntity tile = ((GuiMekanism)guiObj).getTileEntity();
|
||||
|
||||
if(tile instanceof IDropperHandler)
|
||||
if(tile instanceof ITankManager)
|
||||
{
|
||||
int index = Arrays.asList(((IDropperHandler)tile).getTanks()).indexOf(infoHandler.getTank());
|
||||
int index = Arrays.asList(((ITankManager)tile).getTanks()).indexOf(infoHandler.getTank());
|
||||
|
||||
if(index != -1)
|
||||
{
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
@ -113,7 +120,34 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
{
|
||||
if(xAxis >= xLocation + 1 && xAxis <= xLocation + width - 1 && yAxis >= yLocation + 1 && yAxis <= yLocation + height - 1)
|
||||
{
|
||||
guiObj.displayTooltip(getTooltipText(), xAxis, yAxis);
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemConfigurator && color != null)
|
||||
{
|
||||
if(guiObj instanceof GuiMekanism && ((GuiMekanism)guiObj).getTileEntity() != null)
|
||||
{
|
||||
TileEntity tile = ((GuiMekanism)guiObj).getTileEntity();
|
||||
|
||||
if(tile instanceof ISideConfiguration && getTransmission() != null)
|
||||
{
|
||||
SideData data = null;
|
||||
|
||||
for(SideData iterData : ((ISideConfiguration)tile).getConfig().getOutputs(getTransmission()))
|
||||
{
|
||||
if(iterData.color == color)
|
||||
{
|
||||
data = iterData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
guiObj.displayTooltip(color + data.localize() + " (" + color.getName() + ")", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
guiObj.displayTooltip(getTooltipText(), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,6 +162,8 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract TransmissionType getTransmission();
|
||||
|
||||
public void setDummyType(T type)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import static java.lang.Math.min;
|
||||
|
||||
public class GuiNumberGauge extends GuiGauge
|
||||
{
|
||||
|
@ -15,6 +16,12 @@ public class GuiNumberGauge extends GuiGauge
|
|||
|
||||
infoHandler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmission()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScaledLevel()
|
||||
|
|
|
@ -73,7 +73,7 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
|
|||
|
||||
push();
|
||||
|
||||
MekanismRenderer.color(color, 0.4F);
|
||||
MekanismRenderer.color(color, 0.6F);
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
public class SideData
|
||||
{
|
||||
|
@ -36,19 +43,50 @@ public class SideData
|
|||
return MekanismUtils.localize("sideData." + name);
|
||||
}
|
||||
|
||||
public boolean hasSlot(int slot)
|
||||
public boolean hasSlot(int... slots)
|
||||
{
|
||||
for(int i : availableSlots)
|
||||
{
|
||||
if(i == slot)
|
||||
for(int slot : slots)
|
||||
{
|
||||
return true;
|
||||
if(i == slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getFluidTankInfo(ITankManager manager)
|
||||
{
|
||||
Object[] tanks = manager.getTanks();
|
||||
List<FluidTankInfo> infos = new ArrayList<FluidTankInfo>();
|
||||
|
||||
for(int slot : availableSlots)
|
||||
{
|
||||
if(slot <= tanks.length-1 && tanks[slot] instanceof IFluidTank)
|
||||
{
|
||||
infos.add(((IFluidTank)tanks[slot]).getInfo());
|
||||
}
|
||||
}
|
||||
|
||||
return infos.toArray(new FluidTankInfo[] {});
|
||||
}
|
||||
|
||||
public GasTank getGasTank(ITankManager manager)
|
||||
{
|
||||
Object[] tanks = manager.getTanks();
|
||||
|
||||
if(tanks.length < 1 || !(tanks[0] instanceof GasTank))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (GasTank)tanks[0];
|
||||
}
|
||||
|
||||
public static enum EnergyState
|
||||
{
|
||||
INPUT,
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public interface IDropperHandler
|
||||
public interface ITankManager
|
||||
{
|
||||
public Object[] getTanks();
|
||||
|
|
@ -3,8 +3,8 @@ package mekanism.common.network;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.IDropperHandler.DropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.ITankManager.DropperHandler;
|
||||
import mekanism.common.network.PacketDropperUse.DropperUseMessage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
|
@ -18,10 +18,10 @@ public class PacketDropperUse implements IMessageHandler<DropperUseMessage, IMes
|
|||
{
|
||||
TileEntity tileEntity = message.coord4D.getTileEntity(PacketHandler.getPlayer(context).worldObj);
|
||||
|
||||
if(tileEntity instanceof IDropperHandler)
|
||||
if(tileEntity instanceof ITankManager)
|
||||
{
|
||||
try {
|
||||
Object tank = ((IDropperHandler)tileEntity).getTanks()[message.tankId];
|
||||
Object tank = ((ITankManager)tileEntity).getTanks()[message.tankId];
|
||||
|
||||
if(tank != null)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ import mekanism.api.transmitters.TransmissionType;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
|
@ -45,7 +45,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, IDropperHandler
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager
|
||||
{
|
||||
public static final int MAX_GAS = 10000;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import mekanism.api.gas.IGasItem;
|
|||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -36,7 +36,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IGasHandler, IUpgradeTile, ISustainedData, IDropperHandler
|
||||
public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IGasHandler, IUpgradeTile, ISustainedData, ITankManager
|
||||
{
|
||||
public GasTank injectTank = new GasTank(MAX_GAS);
|
||||
public GasTank outputTank = new GasTank(MAX_GAS);
|
||||
|
|
|
@ -19,7 +19,7 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -39,7 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISustainedData, IUpgradeTile, IUpgradeInfoHandler, IDropperHandler
|
||||
public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISustainedData, IUpgradeTile, IUpgradeInfoHandler, ITankManager
|
||||
{
|
||||
public GasTank leftTank = new GasTank(MAX_GAS);
|
||||
public GasTank rightTank = new GasTank(MAX_GAS);
|
||||
|
|
|
@ -16,7 +16,7 @@ import mekanism.api.gas.IGasItem;
|
|||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -34,7 +34,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IUpgradeTile, ISustainedData, IDropperHandler
|
||||
public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IUpgradeTile, ISustainedData, ITankManager
|
||||
{
|
||||
public GasTank gasTank = new GasTank(MAX_GAS);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -49,7 +49,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, IUpgradeTile, ISustainedData, IUpgradeInfoHandler, IDropperHandler
|
||||
public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, IUpgradeTile, ISustainedData, IUpgradeInfoHandler, ITankManager
|
||||
{
|
||||
public FluidTank fluidTank = new FluidTank(MAX_FLUID);
|
||||
public GasTank inputTank = new GasTank(MAX_GAS);
|
||||
|
|
|
@ -15,7 +15,7 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -40,7 +40,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, IDropperHandler
|
||||
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile, ITankManager
|
||||
{
|
||||
/** This pump's tank */
|
||||
public FluidTank fluidTank = new FluidTank(10000);
|
||||
|
|
|
@ -18,7 +18,7 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
|
@ -53,7 +53,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
|
|||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
|
||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedData, IGasHandler, IUpgradeTile, IUpgradeInfoHandler, IDropperHandler
|
||||
public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandler, IPeripheral, ITubeConnection, ISustainedData, IGasHandler, IUpgradeTile, IUpgradeInfoHandler, ITankManager
|
||||
{
|
||||
/** This separator's water slot. */
|
||||
public FluidTank fluidTank = new FluidTank(24000);
|
||||
|
|
|
@ -17,8 +17,8 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.item.ItemUpgrade;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -31,7 +31,6 @@ import mekanism.common.tile.component.TileComponentUpgrade;
|
|||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.PipeUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -48,7 +47,7 @@ import dan200.computercraft.api.lua.ILuaContext;
|
|||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, PressurizedProducts, PressurizedRecipe> implements IFluidHandler, IGasHandler, ITubeConnection, ISustainedData, IDropperHandler
|
||||
public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, PressurizedProducts, PressurizedRecipe> implements IFluidHandler, IGasHandler, ITubeConnection, ISustainedData, ITankManager
|
||||
{
|
||||
public FluidTank inputFluidTank = new FluidTank(10000);
|
||||
public GasTank inputGasTank = new GasTank(10000);
|
||||
|
@ -59,14 +58,24 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
{
|
||||
super("prc", "PressurizedReactionChamber", new ResourceLocation("mekanism", "gui/GuiPRC.png"), usage.pressurizedReactionBaseUsage, 100, MachineType.PRESSURIZED_REACTION_CHAMBER.baseEnergy);
|
||||
|
||||
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
|
||||
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.FLUID, TransmissionType.GAS);
|
||||
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, new int[] {0}));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
|
||||
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
|
||||
|
||||
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 0, 0, 3});
|
||||
|
||||
configComponent.addOutput(TransmissionType.FLUID, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
|
||||
configComponent.addOutput(TransmissionType.FLUID, new SideData("Fluid", EnumColor.YELLOW, new int[] {0}));
|
||||
configComponent.setConfig(TransmissionType.FLUID, new byte[] {0, 0, 0, 1, 0, 0});
|
||||
configComponent.setCanEject(TransmissionType.FLUID, false);
|
||||
|
||||
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
|
||||
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {1}));
|
||||
configComponent.addOutput(TransmissionType.GAS, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
|
||||
configComponent.setConfig(TransmissionType.GAS, new byte[] {0, 0, 0, 0, 1, 2});
|
||||
|
||||
configComponent.setInputEnergyConfig();
|
||||
|
||||
inventory = new ItemStack[4];
|
||||
|
@ -128,7 +137,7 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
|
||||
prevEnergy = getEnergy();
|
||||
|
||||
if(outputGasTank.getGas() != null)
|
||||
if(outputGasTank.getGas() != null && configComponent.isEjecting(TransmissionType.GAS))
|
||||
{
|
||||
GasStack toSend = new GasStack(outputGasTank.getGas().getGas(), Math.min(outputGasTank.getStored(), 16));
|
||||
|
||||
|
@ -330,7 +339,7 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if(from == ForgeDirection.getOrientation(facing).getOpposite())
|
||||
if(canFill(from, resource.getFluid()))
|
||||
{
|
||||
return inputFluidTank.fill(resource, doFill);
|
||||
}
|
||||
|
@ -353,7 +362,9 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if(from == ForgeDirection.getOrientation(facing).getOpposite())
|
||||
SideData data = configComponent.getOutput(TransmissionType.FLUID, from.ordinal(), facing);
|
||||
|
||||
if(data.hasSlot(0))
|
||||
{
|
||||
return inputFluidTank.getFluid() == null || inputFluidTank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
@ -370,18 +381,15 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
if(from == ForgeDirection.getOrientation(facing).getOpposite())
|
||||
{
|
||||
return new FluidTankInfo[] {new FluidTankInfo(inputFluidTank)};
|
||||
}
|
||||
SideData data = configComponent.getOutput(TransmissionType.FLUID, from.ordinal(), facing);
|
||||
|
||||
return PipeUtils.EMPTY;
|
||||
return data.getFluidTankInfo(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer)
|
||||
{
|
||||
if(side == MekanismUtils.getLeft(facing))
|
||||
if(canReceiveGas(side, stack.getGas()))
|
||||
{
|
||||
return inputGasTank.receive(stack, doTransfer);
|
||||
}
|
||||
|
@ -392,7 +400,7 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
|
||||
{
|
||||
if(side == MekanismUtils.getRight(facing))
|
||||
if(canDrawGas(side, null))
|
||||
{
|
||||
return outputGasTank.draw(amount, doTransfer);
|
||||
}
|
||||
|
@ -403,19 +411,19 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
|
|||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return side == MekanismUtils.getLeft(facing) && (inputGasTank.getGas() == null || inputGasTank.getGas().getGas() == type);
|
||||
return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(1) && inputGasTank.canReceive(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return side == MekanismUtils.getRight(facing) && outputGasTank.getGas() != null && outputGasTank.getGas().getGas() == type;
|
||||
return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(2) && outputGasTank.canDraw(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
{
|
||||
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing);
|
||||
return configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).hasSlot(1, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,7 @@ import mekanism.api.Range4D;
|
|||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IFluidContainerManager;
|
||||
import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
|
@ -33,7 +33,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityPortableTank extends TileEntityContainerBlock implements IActiveState, IConfigurable, IFluidHandler, ISustainedTank, IFluidContainerManager, IDropperHandler
|
||||
public class TileEntityPortableTank extends TileEntityContainerBlock implements IActiveState, IConfigurable, IFluidHandler, ISustainedTank, IFluidContainerManager, ITankManager
|
||||
{
|
||||
public boolean isActive;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import mekanism.common.Mekanism;
|
|||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
|
@ -44,7 +44,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock implements IActiveState, ISustainedData, IFluidHandler, IGasHandler, ITubeConnection, IRedstoneControl, IUpgradeTile, IUpgradeInfoHandler, IDropperHandler
|
||||
public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock implements IActiveState, ISustainedData, IFluidHandler, IGasHandler, ITubeConnection, IRedstoneControl, IUpgradeTile, IUpgradeInfoHandler, ITankManager
|
||||
{
|
||||
public GasTank gasTank = new GasTank(MAX_FLUID);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import mekanism.api.Range4D;
|
|||
import mekanism.client.ThreadSparkle.INodeChecker;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -34,7 +34,7 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntitySolarEvaporationController extends TileEntitySolarEvaporationBlock implements IActiveState, IDropperHandler
|
||||
public class TileEntitySolarEvaporationController extends TileEntitySolarEvaporationBlock implements IActiveState, ITankManager
|
||||
{
|
||||
public static final int MAX_OUTPUT = 10000;
|
||||
public static final int MAX_SOLARS = 4;
|
||||
|
|
|
@ -16,7 +16,7 @@ import mekanism.api.gas.ITubeConnection;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IBoundingBlock;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
|
@ -30,7 +30,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.biome.BiomeGenDesert;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, IDropperHandler
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, ITankManager
|
||||
{
|
||||
public GasTank inputTank = new GasTank(MAX_GAS);
|
||||
public GasTank outputTank = new GasTank(MAX_GAS);
|
||||
|
|
|
@ -688,6 +688,7 @@ sideData.Energy=Energy
|
|||
sideData.Gas=Gas
|
||||
sideData.Extra=Extra
|
||||
sideData.Infuse=Infuse
|
||||
sideData.Fluid=Fluid
|
||||
|
||||
//Redstone control
|
||||
control.disabled=Disabled
|
||||
|
|
Loading…
Reference in a new issue