Boiler fix and fluid gauge compatibility re-added.

This commit is contained in:
BallOfEnergy 2023-08-08 13:17:13 -05:00
parent 3387cc7f4e
commit e02e28b5d0
2 changed files with 23 additions and 6 deletions

View File

@ -15,8 +15,13 @@ import com.hbm.tileentity.network.TileEntityPipeBaseNT;
import com.hbm.util.I18nUtil;
import api.hbm.fluid.IPipeNet;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -101,7 +106,8 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
return IBlockMultiPass.getRenderType();
}
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements INBTPacketReceiver {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements INBTPacketReceiver, SimpleComponent {
private BigInteger lastMeasurement = BigInteger.valueOf(10);
private long deltaTick = 0;
@ -145,5 +151,20 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
}
public String getComponentName() {
return "rbmk_boiler";
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getTransfer(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond};
}
}
}

View File

@ -375,7 +375,7 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
else if(type == Fluids.HOTSTEAM) {type_1 = "1";}
else if(type == Fluids.SUPERHOTSTEAM) {type_1 = "2";}
else if(type == Fluids.ULTRAHOTSTEAM) {type_1 = "3";}
else {type_1 = "Steam out-of-bounds";}
else {type_1 = "Unknown Error";}
return new Object[] {heat, steam.getFill(), steam.getMaxFill(), feed.getFill(), feed.getMaxFill(), type_1, xCoord, yCoord, zCoord};
}
@ -401,19 +401,15 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
}
if(type == 0) {
steam.setTankType(Fluids.STEAM);
steam.setFill(0); //too lazy to add a ton of additional code to divide the fill amount, fuck your steam
return new Object[] {true};
} else if(type == 1) {
steam.setTankType(Fluids.HOTSTEAM);
steam.setFill(0);
return new Object[] {true};
} else if(type == 2) {
steam.setTankType(Fluids.SUPERHOTSTEAM);
steam.setFill(0);
return new Object[] {true};
} else {
steam.setTankType(Fluids.ULTRAHOTSTEAM);
steam.setFill(0);
return new Object[] {true};
}
}