Update TileEntityReactorZirnox.java

This commit is contained in:
Voxelstice 2022-05-13 16:20:40 +10:00 committed by GitHub
parent cf93a0be4a
commit 46adbf3273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,14 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver {
import cpw.mods.fml.common.Optional;
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;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver, SimpleComponent {
public int heat;
public static final int maxHeat = 100000;
@ -498,4 +505,46 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
this.markDirty();
}
}
// do some opencomputer stuff
@Override
public String getComponentName() {
return "zirnox_reactor";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getTemp(Context context, Arguments args) { // or getHeat, whatever.
return new Object[] {heat};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getPressure(Context context, Arguments args) {
return new Object[] {pressure};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getWater(Context context, Arguments args) {
return new Object[] {water.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCarbonDioxide(Context context, Arguments args) {
return new Object[] {carbonDioxide.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] isActive(Context context, Arguments args) {
return new Object[] {isOn};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] setActive(Context context, Arguments args) {
isOn = Boolean.parseBoolean(args.checkString(0));
return new Object[] {};
}
}