mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #2862 from DTK-MrRaccoon/ror
Added more RoR functions to zirnox and gas turbine.
This commit is contained in:
commit
0be2e08b8f
@ -26,6 +26,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -37,7 +38,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable {
|
||||
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable, IRORValueProvider {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -358,4 +359,24 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPa
|
||||
writer.name("D:diffusion").value(diffusion);
|
||||
writer.name("B:canExplode").value(canExplode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "input",
|
||||
PREFIX_VALUE + "output"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if (hasExploded) {
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "0";
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "0";
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "" + tanks[0].getFill();
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "" + tanks[1].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -31,7 +32,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable {
|
||||
public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiverMK2, IConfigurableMachine, IFluidCopiable, IRORValueProvider {
|
||||
|
||||
public int heat;
|
||||
public FluidTank[] tanks;
|
||||
@ -320,4 +321,19 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme
|
||||
writer.name("I:maxHeat").value(maxHeat);
|
||||
writer.name("D:diffusion").value(diffusion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "input",
|
||||
PREFIX_VALUE + "output"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if ((PREFIX_VALUE + "input").equals(name)) return "" + tanks[0].getFill();
|
||||
if ((PREFIX_VALUE + "output").equals(name)) return "" + tanks[1].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,8 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -40,7 +42,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyProviderMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable {
|
||||
public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyProviderMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public boolean isOn = false;
|
||||
public static long maxPower = 2_500_000;
|
||||
@ -474,4 +476,57 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_VALUE + "throttle",
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "efficiency",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "throttle"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if ((PREFIX_VALUE + "state").equals(name)) return "" + (isOn ? 1 : 0);
|
||||
if ((PREFIX_VALUE + "throttle").equals(name)) return "" + setting;
|
||||
if ((PREFIX_VALUE + "power").equals(name)) return "" + power;
|
||||
if ((PREFIX_VALUE + "fuel").equals(name)) return "" + tank.getFill();
|
||||
if ((PREFIX_VALUE + "efficiency").equals(name)) {
|
||||
if (slots[2] != null && slots[2].getItem() == ModItems.piston_set && tank.getTankType().hasTrait(FT_Combustible.class)) {
|
||||
EnumPistonType piston = EnumUtil.grabEnumSafely(EnumPistonType.class, slots[2].getItemDamage());
|
||||
FT_Combustible trait = tank.getTankType().getTrait(FT_Combustible.class);
|
||||
double eff = piston.eff[trait.getGrade().ordinal()];
|
||||
return "" + (int) Math.round(eff * 100);
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if ((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.isOn = (val == 1);
|
||||
this.markDirty();
|
||||
} catch (NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
if (val < 0) val = 0;
|
||||
if (val > 30) val = 30;
|
||||
this.setting = val;
|
||||
this.markDirty();
|
||||
} catch (NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import com.hbm.util.CompatEnergyControl;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -45,7 +46,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyProviderMK2, IControlReceiver, IGUIProvider, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider {
|
||||
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyProviderMK2, IControlReceiver, IGUIProvider, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000L;
|
||||
@ -734,7 +735,18 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "turbinepercent",
|
||||
PREFIX_VALUE + "turbinespeed",
|
||||
PREFIX_VALUE + "output"
|
||||
PREFIX_VALUE + "output",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_VALUE + "autoMode",
|
||||
PREFIX_VALUE + "temp",
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "lubricant",
|
||||
PREFIX_VALUE + "water",
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_FUNCTION + "setAuto" + NAME_SEPARATOR + "auto",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "percent",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state"
|
||||
};
|
||||
}
|
||||
|
||||
@ -742,7 +754,50 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "turbinepercent").equals(name)) return "" + (int) (this.powerSliderPos * 100D / 60D);
|
||||
if((PREFIX_VALUE + "turbinespeed").equals(name)) return "" + this.rpm;
|
||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) this.instantPowerOutput;
|
||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) (this.instantPowerOutput * 20);
|
||||
if((PREFIX_VALUE + "state").equals(name)) return "" + this.state;
|
||||
if((PREFIX_VALUE + "autoMode").equals(name)) return "" + (this.autoMode ? 1 : 0);
|
||||
if((PREFIX_VALUE + "temp").equals(name)) return "" + this.temp;
|
||||
if((PREFIX_VALUE + "power").equals(name)) return "" + this.power;
|
||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tanks[0].getFill();
|
||||
if((PREFIX_VALUE + "lubricant").equals(name)) return "" + tanks[1].getFill();
|
||||
if((PREFIX_VALUE + "water").equals(name)) return "" + tanks[2].getFill();
|
||||
if((PREFIX_VALUE + "steam").equals(name)) return "" + tanks[3].getFill();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setAuto").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.autoMode = (val == 1);
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int percent = Integer.parseInt(params[0]);
|
||||
if(percent < 0) percent = 0;
|
||||
if(percent > 100) percent = 100;
|
||||
this.powerSliderPos = percent * 60 / 100;
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int newState = Integer.parseInt(params[0]);
|
||||
if(newState == 1) {
|
||||
if(this.state == 0) this.state = -1; // startup
|
||||
} else if(newState == 0) {
|
||||
if(this.state == 1) this.state = 0; // shutdown
|
||||
}
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -50,7 +51,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IControlReceiver, IFluidStandardTransceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORValueProvider {
|
||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IControlReceiver, IFluidStandardTransceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public int heat;
|
||||
public static final int maxHeat = 100000;
|
||||
@ -603,14 +604,44 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "heat",
|
||||
PREFIX_VALUE + "pressure"
|
||||
PREFIX_VALUE + "pressure",
|
||||
PREFIX_VALUE + "water",
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_VALUE + "co2",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active",
|
||||
PREFIX_FUNCTION + "ventCO2"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + (int) Math.round(heat * 1.0E-5D * 780.0D + 20.0D);
|
||||
if((PREFIX_VALUE + "pressure").equals(name)) return "" + (int) Math.round(pressure * 1.0E-5D * 30.0D);
|
||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + (int) Math.round(heat * 1.0E-5D * 780.0D + 20.0D);
|
||||
if((PREFIX_VALUE + "pressure").equals(name)) return "" + (int) Math.round(pressure * 1.0E-5D * 30.0D);
|
||||
if((PREFIX_VALUE + "water").equals(name)) return "" + water.getFill();
|
||||
if((PREFIX_VALUE + "steam").equals(name)) return "" + steam.getFill();
|
||||
if((PREFIX_VALUE + "co2").equals(name)) return "" + carbonDioxide.getFill();
|
||||
if((PREFIX_VALUE + "state").equals(name)) return "" + (isOn ? 1 : 0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
if(redstonePowered) return null;
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.isOn = (val == 1);
|
||||
this.markDirty();
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "ventCO2").equals(name)) {
|
||||
int fill = this.carbonDioxide.getFill();
|
||||
this.carbonDioxide.setFill(Math.max(fill - 1000, 0));
|
||||
this.markDirty();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user