mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #2139 from Toshayo/opencomputers-steam-fluid-id-fix
Better steam turbine OpenComputers integration
This commit is contained in:
commit
763b6ec020
@ -38,16 +38,15 @@ public class CompatHandler {
|
|||||||
* @return Object[] array containing an int with the "compression level"
|
* @return Object[] array containing an int with the "compression level"
|
||||||
*/
|
*/
|
||||||
public static Object[] steamTypeToInt(FluidType type) {
|
public static Object[] steamTypeToInt(FluidType type) {
|
||||||
switch(type.getID()) {
|
final int typeId = type.getID();
|
||||||
case(4): // Fluids.HOTSTEAM
|
if(typeId == Fluids.HOTSTEAM.getID()) {
|
||||||
return new Object[] {1};
|
return new Object[]{1};
|
||||||
case(5): // Fluids.SUPERHOTSTEAM
|
} else if(typeId == Fluids.SUPERHOTSTEAM.getID()) {
|
||||||
return new Object[] {2};
|
return new Object[]{2};
|
||||||
case(6): // Fluids.ULTRAHOTSTEAM
|
} else if(typeId == Fluids.ULTRAHOTSTEAM.getID()) {
|
||||||
return new Object[] {3};
|
return new Object[]{3};
|
||||||
default:
|
}
|
||||||
return new Object[] {0};
|
return new Object[] {0};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -297,29 +297,35 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():table -- Gets current tanks state. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getFluid(Context context, Arguments args) {
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the current input tank fluid type. 0 stands for steam, 1 for dense steam, 2 for super dense steam and 3 for ultra dense steam.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getType(Context context, Arguments args) {
|
public Object[] getType(Context context, Arguments args) {
|
||||||
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
|
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true, limit = 4)
|
@Callback(direct = true, limit = 4, doc = "function(type:number) -- Sets the input tank fluid type. Refer getType() for the accepted values information.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] setType(Context context, Arguments args) {
|
public Object[] setType(Context context, Arguments args) {
|
||||||
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
||||||
return new Object[] {};
|
return new Object[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the power buffer of the turbine.")
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPower(Context context, Arguments args) {
|
||||||
|
return new Object[] {power};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, doc = "function():table -- Gets information about this turbine. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>, <input tank fluid type>, <power>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getInfo(Context context, Arguments args) {
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())[0], power};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -329,6 +335,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
|||||||
"getFluid",
|
"getFluid",
|
||||||
"getType",
|
"getType",
|
||||||
"setType",
|
"setType",
|
||||||
|
"getPower",
|
||||||
"getInfo"
|
"getInfo"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -343,6 +350,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr
|
|||||||
return getType(context, args);
|
return getType(context, args);
|
||||||
case ("setType"):
|
case ("setType"):
|
||||||
return setType(context, args);
|
return setType(context, args);
|
||||||
|
case ("getPower"):
|
||||||
|
return getPower(context, args);
|
||||||
case ("getInfo"):
|
case ("getInfo"):
|
||||||
return getInfo(context, args);
|
return getInfo(context, args);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -302,29 +302,35 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():table -- Gets current tanks state. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getFluid(Context context, Arguments args) {
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the current input tank fluid type. 0 stands for steam, 1 for dense steam, 2 for super dense steam and 3 for ultra dense steam.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getType(Context context, Arguments args) {
|
public Object[] getType(Context context, Arguments args) {
|
||||||
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
|
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true, limit = 4)
|
@Callback(direct = true, limit = 4, doc = "function(type:number) -- Sets the input tank fluid type. Refer getType() for the accepted values information.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] setType(Context context, Arguments args) {
|
public Object[] setType(Context context, Arguments args) {
|
||||||
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
||||||
return new Object[] {};
|
return new Object[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the power buffer of the turbine.")
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPower(Context context, Arguments args) {
|
||||||
|
return new Object[] {power};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, doc = "function():table -- Gets information about this turbine. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>, <input tank fluid type>, <power>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getInfo(Context context, Arguments args) {
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())[0], power};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -334,6 +340,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
|||||||
"getFluid",
|
"getFluid",
|
||||||
"getType",
|
"getType",
|
||||||
"setType",
|
"setType",
|
||||||
|
"getPower",
|
||||||
"getInfo"
|
"getInfo"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -355,29 +355,35 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
|||||||
return "ntm_turbine";
|
return "ntm_turbine";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():table -- Gets current tanks state. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getFluid(Context context, Arguments args) {
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the current input tank fluid type. 0 stands for steam, 1 for dense steam, 2 for super dense steam and 3 for ultra dense steam.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getType(Context context, Arguments args) {
|
public Object[] getType(Context context, Arguments args) {
|
||||||
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
|
return CompatHandler.steamTypeToInt(tanks[0].getTankType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true, limit = 4)
|
@Callback(direct = true, limit = 4, doc = "function(type:number) -- Sets the input tank fluid type. Refer getType() for the accepted values information.")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] setType(Context context, Arguments args) {
|
public Object[] setType(Context context, Arguments args) {
|
||||||
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
|
||||||
return new Object[] {true};
|
return new Object[] {true};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true, doc = "function():number -- Gets the power buffer of the turbine.")
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPower(Context context, Arguments args) {
|
||||||
|
return new Object[] {power};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, doc = "function():table -- Gets information about this turbine. The format is the following: <input tank amount>, <input tank capacity>, <output tank amount>, <output tank capacity>, <input tank fluid type>, <power>")
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getInfo(Context context, Arguments args) {
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
|
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())[0], power};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user