mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fluid Gauge OC compat for reading fluid flows.
This commit is contained in:
parent
424d6c3486
commit
1d756bc671
@ -15,8 +15,13 @@ import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
|||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import api.hbm.fluid.IPipeNet;
|
import api.hbm.fluid.IPipeNet;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.BlockPistonBase;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@ -101,7 +106,8 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
return IBlockMultiPass.getRenderType();
|
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 BigInteger lastMeasurement = BigInteger.valueOf(10);
|
||||||
private long deltaTick = 0;
|
private long deltaTick = 0;
|
||||||
@ -144,5 +150,34 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
||||||
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fluid_gauge";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, limit = 16)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getTick(Context context, Arguments args) {
|
||||||
|
return new Object[] {deltaTick};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, limit = 16)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getSecond(Context context, Arguments args) {
|
||||||
|
return new Object[] {deltaSecond};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, limit = 16)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getType(Context context, Arguments args) {
|
||||||
|
return new Object[] {I18nUtil.resolveKey(getType().getUnlocalizedName())};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, limit = 16)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {deltaTick, deltaSecond, I18nUtil.resolveKey(getType().getUnlocalizedName()), xCoord, yCoord, zCoord};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user