mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Computer support for Turbine Valve
This commit is contained in:
1 parent
924392df2e
commit
e85f9ebd73
3 files changed
+45
-4
No files matched your search
@@ -14,7 +14,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
/**
|
||||
* Think of this class as a "Two dimensional ForgeDirection, with diagonals".
|
||||
* Think of this class as a "Two dimensional EnumFacing, with diagonals".
|
||||
* <p>
|
||||
* It represents the eight different directions a face of a block can connect with CTM, and contains the logic for determining if a block is indeed connected in that direction.
|
||||
* <p>
|
||||
|
||||
@@ -80,8 +80,8 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
||||
setEnergy(getEnergy()+((int)rate)*energyMultiplier);
|
||||
|
||||
structure.fluidStored.amount -= rate;
|
||||
structure.clientFlow = Math.min((int)rate, structure.condensers*generators.condenserRate);
|
||||
structure.flowRemaining = (int)rate;
|
||||
structure.clientFlow = (int)rate;
|
||||
structure.flowRemaining = Math.min((int)rate, structure.condensers*generators.condenserRate);
|
||||
|
||||
if(structure.fluidStored.amount == 0)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ import mekanism.common.base.IFluidHandlerWrapper;
|
||||
import mekanism.common.capabilities.Capabilities;
|
||||
import mekanism.common.capabilities.CapabilityWrapperManager;
|
||||
import mekanism.common.config.MekanismConfig.general;
|
||||
import mekanism.common.config.MekanismConfig.generators;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
import mekanism.common.integration.forgeenergy.ForgeEnergyIntegration;
|
||||
import mekanism.common.integration.tesla.TeslaIntegration;
|
||||
import mekanism.common.tile.TileEntityGasTank.GasMode;
|
||||
@@ -36,7 +38,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fml.common.Optional.Method;
|
||||
|
||||
public class TileEntityTurbineValve extends TileEntityTurbineCasing implements IFluidHandlerWrapper, IEnergyWrapper
|
||||
public class TileEntityTurbineValve extends TileEntityTurbineCasing implements IFluidHandlerWrapper, IEnergyWrapper, IComputerIntegration
|
||||
{
|
||||
public boolean ic2Registered = false;
|
||||
|
||||
@@ -421,6 +423,45 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
|
||||
return LangUtils.localize("gui.industrialTurbine");
|
||||
}
|
||||
|
||||
private static final String[] methods = new String[] {"isFormed", "getSteam", "getFlowRate", "getMaxFlow", "getSteamInput"};
|
||||
|
||||
@Override
|
||||
public String[] getMethods()
|
||||
{
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] invoke(int method, Object[] arguments) throws Exception
|
||||
{
|
||||
if(method == 0)
|
||||
{
|
||||
return new Object[] {structure != null};
|
||||
}
|
||||
else {
|
||||
if(structure == null)
|
||||
{
|
||||
return new Object[] {"Unformed"};
|
||||
}
|
||||
|
||||
switch(method)
|
||||
{
|
||||
case 1:
|
||||
return new Object[] {structure.fluidStored != null ? structure.fluidStored.amount : 0};
|
||||
case 2:
|
||||
return new Object[] {structure.clientFlow};
|
||||
case 3:
|
||||
double rate = structure.lowerVolume*(structure.clientDispersers*generators.turbineDisperserGasFlow);
|
||||
rate = Math.min(rate, structure.vents*generators.turbineVentGasFlow);
|
||||
return new Object[] {rate};
|
||||
case 4:
|
||||
return new Object[] {structure.lastSteamInput};
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing side)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user