本文整理汇总了Java中mekanism.api.gas.GasTank类的典型用法代码示例。如果您正苦于以下问题:Java GasTank类的具体用法?Java GasTank怎么用?Java GasTank使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GasTank类属于mekanism.api.gas包,在下文中一共展示了GasTank类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTank
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GasTank getTank(ForgeDirection side)
{
if(side == MekanismUtils.getLeft(facing))
{
return leftTank;
}
else if(side == MekanismUtils.getRight(facing))
{
return rightTank;
}
else if(side == ForgeDirection.getOrientation(facing))
{
return centerTank;
}
return null;
}
示例2: applyOutputs
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public boolean applyOutputs(GasTank leftTank, GasTank rightTank, boolean doEmit, int scale)
{
if(leftTank.canReceive(leftGas.getGas()) && rightTank.canReceive(rightGas.getGas()))
{
if(leftTank.getNeeded() >= leftGas.amount*scale && rightTank.getNeeded() >= rightGas.amount*scale)
{
leftTank.receive(leftGas.copy().withAmount(leftGas.amount*scale), doEmit);
rightTank.receive(rightGas.copy().withAmount(rightGas.amount*scale), doEmit);
return true;
}
}
else if(leftTank.canReceive(rightGas.getGas()) && rightTank.canReceive(leftGas.getGas()))
{
if(leftTank.getNeeded() >= rightGas.amount*scale && rightTank.getNeeded() >= leftGas.amount*scale)
{
leftTank.receive(rightGas.copy().withAmount(rightGas.amount*scale), doEmit);
rightTank.receive(leftGas.copy().withAmount(leftGas.amount*scale), doEmit);
return true;
}
}
return false;
}
示例3: GuiGasGenerator
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GuiGasGenerator(InventoryPlayer inventory, TileEntityGasGenerator tentity)
{
super(new ContainerGasGenerator(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
return ListUtils.asList(
MekanismUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.generationRate) + "/t",
MekanismUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
MekanismUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.fuelTank;
}
}, Type.WIDE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 55, 18));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 164, 15));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 16, 34).with(SlotOverlay.MINUS));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiGasGenerator.png"), 142, 34).with(SlotOverlay.POWER));
}
示例4: GuiChemicalCrystallizer
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GuiChemicalCrystallizer(InventoryPlayer inventory, TileEntityChemicalCrystallizer tentity)
{
super(tentity, new ContainerChemicalCrystallizer(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 160, 23));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.inputTank;
}
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 5, 4));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 5, 64).with(SlotOverlay.PLUS));
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 154, 4).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 130, 56));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return tileEntity.getScaledProgress();
}
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 51, 60));
}
示例5: GuiAmbientAccumulator
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GuiAmbientAccumulator(EntityPlayer player, TileEntityAmbientAccumulator tile)
{
super(tile, new ContainerNull(player, tile));
tileEntity = tile;
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.collectedGas;
}
}, Type.WIDE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 26, 16));
}
示例6: GuiChemicalOxidizer
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GuiChemicalOxidizer(InventoryPlayer inventory, TileEntityChemicalOxidizer tentity)
{
super(tentity, new ContainerChemicalOxidizer(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.gasTank;
}
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 4).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 24).with(SlotOverlay.PLUS));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return tileEntity.getScaledProgress();
}
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39));
}
示例7: GuiSolarNeutronActivator
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GuiSolarNeutronActivator(InventoryPlayer inventory, TileEntitySolarNeutronActivator tentity)
{
super(tentity, new ContainerSolarNeutronActivator(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 55).with(SlotOverlay.MINUS));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 154, 55).with(SlotOverlay.PLUS));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.inputTank;
}
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 25, 13));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.outputTank;
}
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 133, 13));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return tileEntity.isActive ? 1 : 0;
}
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 62, 38));
}
示例8: getTank
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public GasTank getTank(ForgeDirection side)
{
if(side == MekanismUtils.getLeft(facing))
{
return inputTank;
}
else if(side == MekanismUtils.getRight(facing))
{
return outputTank;
}
return null;
}
示例9: TileEntityFactory
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public TileEntityFactory(FactoryTier type, MachineType machine)
{
super("null", machine.name, machine.baseEnergy);
tier = type;
inventory = new ItemStack[5+type.processes*2];
progress = new int[type.processes];
isActive = false;
gasTank = new GasTank(TileEntityAdvancedElectricMachine.MAX_GAS*tier.processes);
}
示例10: TileEntityAdvancedElectricMachine
import mekanism.api.gas.GasTank; //导入依赖的package包/类
/**
* Advanced Electric Machine -- a machine like this has a total of 4 slots. Input slot (0), fuel slot (1), output slot (2),
* energy slot (3), and the upgrade slot (4). The machine will not run if it does not have enough electricity, or if it doesn't have enough
* fuel ticks.
*
* @param soundPath - location of the sound effect
* @param name - full name of this machine
* @param perTick - how much energy this machine uses per tick.
* @param secondaryPerTick - how much secondary energy (fuel) this machine uses per tick.
* @param ticksRequired - how many ticks it takes to smelt an item.
* @param maxEnergy - maximum amount of energy this machine can hold.
*/
public TileEntityAdvancedElectricMachine(String soundPath, String name, double perTick, int secondaryPerTick, int ticksRequired, double maxEnergy)
{
super(soundPath, name, MekanismUtils.getResource(ResourceType.GUI, "GuiAdvancedMachine.png"), perTick, ticksRequired, maxEnergy);
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
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("Extra", EnumColor.PURPLE, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, new int[] {2}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {3}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {2, 1, 0, 4, 0, 3});
configComponent.setInputEnergyConfig();
gasTank = new GasTank(MAX_GAS);
inventory = new ItemStack[5];
BASE_SECONDARY_ENERGY_PER_TICK = secondaryPerTick;
secondaryEnergyPerTick = secondaryPerTick;
upgradeComponent = upgradeableSecondaryEfficiency() ? new TileComponentAdvancedUpgrade(this, 4) : new TileComponentUpgrade(this, 4);
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3));
}
示例11: SharedInventory
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public SharedInventory(String freq)
{
name = freq;
storedEnergy = 0;
storedFluid = new FluidTank(1000);
storedGas = new GasTank(1000);
storedItem = null;
}
示例12: applyOutputs
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public boolean applyOutputs(GasTank gasTank, boolean doEmit, int scale)
{
if(gasTank.canReceive(output.getGas()) && gasTank.getNeeded() >= output.amount*scale)
{
gasTank.receive(output.copy().withAmount(output.amount*scale), doEmit);
return true;
}
return false;
}
示例13: draw
import mekanism.api.gas.GasTank; //导入依赖的package包/类
/**
* Draws the needed amount of gas from each tank.
* @param leftTank - left tank to draw from
* @param rightTank - right tank to draw from
*/
public void draw(GasTank leftTank, GasTank rightTank)
{
if(meets(new ChemicalPairOutput(leftTank.getGas(), rightTank.getGas())))
{
leftTank.draw(leftGas.amount, true);
rightTank.draw(rightGas.amount, true);
}
else if(meets(new ChemicalPairOutput(rightTank.getGas(), leftTank.getGas())))
{
leftTank.draw(rightGas.amount, true);
rightTank.draw(leftGas.amount, true);
}
}
示例14: applyOutputs
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public boolean applyOutputs(ItemStack[] inventory, int index, GasTank tank, boolean doEmit)
{
if(canFillTank(tank) && canAddProducts(inventory, index))
{
if(doEmit)
{
fillTank(tank);
addProducts(inventory, index);
}
return true;
}
return false;
}
示例15: use
import mekanism.api.gas.GasTank; //导入依赖的package包/类
public boolean use(ItemStack[] inventory, int index, FluidTank fluidTank, GasTank gasTank, boolean deplete)
{
if(meets(new PressurizedInput(inventory[index], fluidTank.getFluid(), gasTank.getGas())))
{
if(deplete)
{
inventory[index] = StackUtils.subtract(inventory[index], theSolid);
fluidTank.drain(theFluid.amount, true);
gasTank.draw(theGas.amount, true);
}
return true;
}
return false;
}