use of me.desht.pneumaticcraft.api.heat.IHeatExchangerLogic in project pnc-repressurized by TeamPneumatic.
the class TileEntityBase method addLuaMethods.
protected void addLuaMethods() {
if (this instanceof IHeatExchanger) {
final IHeatExchanger exchanger = (IHeatExchanger) this;
luaMethods.add(new LuaMethod("getTemperature") {
@Override
public Object[] call(Object[] args) throws Exception {
if (args.length == 0) {
return new Object[] { exchanger.getHeatExchangerLogic(null).getTemperature() };
} else if (args.length == 1) {
IHeatExchangerLogic logic = exchanger.getHeatExchangerLogic(getDirForString((String) args[0]));
return new Object[] { logic != null ? logic.getTemperature() : 0 };
} else {
throw new IllegalArgumentException("getTemperature method requires 0 or 1 argument (direction: up, down, east, west, north, south!");
}
}
});
}
}
Aggregations