From e02e28b5d089d164890345087c610dfc0c85ec48 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:17:13 -0500 Subject: [PATCH] Boiler fix and fluid gauge compatibility re-added. --- .../hbm/blocks/network/FluidDuctGauge.java | 23 ++++++++++++++++++- .../machine/rbmk/TileEntityRBMKBoiler.java | 6 +---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java b/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java index f9dc2498f..dfd617423 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java @@ -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}; + } } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java index 654c7878e..44baadde9 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java @@ -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}; } }