Merge pull request #1261 from BallOfEnergy1/New_master

OpenComputers Compatibility!
This commit is contained in:
HbmMods 2023-12-10 19:00:53 +01:00 committed by GitHub
commit 12badf2bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 449 additions and 233 deletions

View File

@ -191,7 +191,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR),
DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC),
CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK),
MICROWAVE( "Microwave", "Microwave", "OC compat", "they call me the food heater", true, ScrapType.BRIDGE_BIOS),
MICROWAVE( "Microwave", "Microwave", "OC Compatibility", "they call me the food heater", true, ScrapType.BRIDGE_BIOS),
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CPU_CLOCK);
public String name; //the title of the tooltip

View File

@ -156,19 +156,19 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
return "ntm_fluid_gauge";
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTransfer(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {getType().getName()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {deltaTick, deltaSecond, getType().getName(), xCoord, yCoord, zCoord};

View File

@ -0,0 +1,31 @@
package com.hbm.handler;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
/**
* General handler for OpenComputers compatibility.
* <p/>
* Mostly just functions used across many TEs.
*/
public class CompatHandler {
public static Object[] steamTypeToInt(FluidType type) {
if(type == Fluids.STEAM) {return new Object[] {0};}
else if(type == Fluids.HOTSTEAM) {return new Object[] {1};}
else if(type == Fluids.SUPERHOTSTEAM) {return new Object[] {2};}
return new Object[] {3};
}
public static FluidType intToSteamType(int arg) {
switch(arg) {
default:
return Fluids.STEAM;
case(1):
return Fluids.HOTSTEAM;
case(2):
return Fluids.SUPERHOTSTEAM;
case(3):
return Fluids.ULTRAHOTSTEAM;
}
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Random;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.CompatHandler;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.fluid.FluidType;
@ -22,15 +23,20 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
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.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcceptor, IFluidSource, IEnergyGenerator, INBTPacketReceiver, IFluidStandardTransceiver {
public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcceptor, IFluidSource, IEnergyGenerator, INBTPacketReceiver, IFluidStandardTransceiver, SimpleComponent {
public long power;
public static final long maxPower = 100000000000L;
@ -275,6 +281,36 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
this.power = power;
}
@Override
public String getComponentName() {
return "ntm_turbine";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setType(Context context, Arguments args) {
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
return new Object[] {true};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[1]};

View File

@ -274,53 +274,48 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
return "dfc_emitter";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCryogel(Context context, Arguments args) {
return new Object[] {tank.getFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInput(Context context, Arguments args) {
return new Object[] {watts};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower(), tank.getFill(), watts, isOn};
}
@Callback(direct = true, limit = 2)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] isActive(Context context, Arguments args) {
return new Object[] {isOn};
}
@Callback(direct = true, limit = 2)
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setActive(Context context, Arguments args) {
isOn = args.checkBoolean(0);
return new Object[] {};
}
@Callback(direct = true, limit = 2)
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setInput(Context context, Arguments args) {
int newOutput = args.checkInteger(0);
if (newOutput > 100) {
newOutput = 100;
} else if (newOutput < 0) {
newOutput = 0;
}
watts = newOutput;
watts = MathHelper.clamp_int(newOutput, 0, 100);
return new Object[] {};
}

View File

@ -199,19 +199,19 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
return "dfc_injector";
}
@Callback(direct = true, limit = 2)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFuel(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
}
@Callback(direct = true, limit = 2)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTypes(Context context, Arguments args) {
return new Object[] {tanks[0].getTankType().getName(), tanks[1].getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getTankType().getName(), tanks[1].getFill(), tanks[1].getTankType().getName()};

View File

@ -191,19 +191,19 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
return "dfc_receiver";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {joules, getPower()}; //literally only doing this for the consistency between components
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCryogel(Context context, Arguments args) {
return new Object[] {tank.getFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {joules, getPower(), tank.getFill()};

View File

@ -172,19 +172,19 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
return "dfc_stabilizer";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInput(Context context, Arguments args) {
return new Object[] {watts};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getDurability(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() == ModItems.ams_lens && ItemLens.getLensDamage(slots[0]) < ((ItemLens)ModItems.ams_lens).maxDamage) {
@ -193,7 +193,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
Object lens_damage_buf;
@ -205,16 +205,11 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
return new Object[] {power, maxPower, watts, lens_damage_buf};
}
@Callback(direct = true, limit = 2)
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setInput(Context context, Arguments args) {
int newOutput = args.checkInteger(0);
if (newOutput > 100) {
newOutput = 100;
} else if (newOutput < 0) {
newOutput = 0;
}
watts = newOutput;
watts = MathHelper.clamp_int(newOutput, 0, 100);
return new Object[] {};
}

View File

@ -68,7 +68,7 @@ public class TileEntityGeiger extends TileEntity implements SimpleComponent {
return "ntm_geiger";
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getRads(Context context, Arguments args) {
return new Object[] {check()};

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.CompatHandler;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
@ -21,8 +22,13 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardTransceiver;
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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -32,7 +38,8 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent {
public long power;
public static final long maxPower = 100000000;
@ -280,6 +287,36 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
return new FluidTank[] {tanks[0]};
}
@Override
public String getComponentName() {
return "ntm_turbine";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setType(Context context, Arguments args) {
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
return new Object[] {true};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineLargeTurbine(player.inventory, this);

View File

@ -3,6 +3,7 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.CompatHandler;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
@ -22,9 +23,14 @@ import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -35,7 +41,8 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver, IGUIProvider, SimpleComponent {
private ItemStack slots[];
@ -376,6 +383,36 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
return tanks;
}
@Override
public String getComponentName() {
return "ntm_turbine";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return CompatHandler.steamTypeToInt(tanks[1].getTankType());
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setType(Context context, Arguments args) {
tanks[0].setTankType(CompatHandler.intToSteamType(args.checkInteger(0)));
return new Object[] {true};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill(), CompatHandler.steamTypeToInt(tanks[0].getTankType())};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineTurbine(player.inventory, this);

View File

@ -22,8 +22,13 @@ import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardTransceiver;
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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -33,7 +38,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyGenerator, IControlReceiver, IGUIProvider {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyGenerator, IControlReceiver, IGUIProvider, SimpleComponent {
public long power;
public static final long maxPower = 1000000L;
@ -546,6 +552,92 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
return dir != ForgeDirection.DOWN;
}
@Override
public String getComponentName() {
return "ntm_gas_turbine";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluid(Context context, Arguments args) {
return new Object[] {
tanks[0].getFill(), tanks[0].getMaxFill(),
tanks[1].getFill(), tanks[1].getMaxFill(),
tanks[2].getFill(), tanks[2].getMaxFill(),
tanks[3].getFill(), tanks[3].getMaxFill()
};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
return new Object[] {tanks[0].getTankType().getName()};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPower(Context context, Arguments args) {
return new Object[] {power};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getThrottle(Context context, Arguments args) {
return new Object[] {throttle};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getState(Context context, Arguments args) {
return new Object[] {state};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getAuto(Context context, Arguments args) {
return new Object[] {autoMode};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setThrottle(Context context, Arguments args) {
throttle = args.checkInteger(0);
return new Object[] {true};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setAuto(Context context, Arguments args) {
autoMode = args.checkBoolean(0);
return new Object[] {true};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] start(Context context, Arguments args) {
stopIfNotReady();
startup();
return new Object[] {true};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] stop(Context context, Arguments args) {
shutdown();
return new Object[] {true};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {throttle, state,
tanks[0].getFill(), tanks[0].getMaxFill(),
tanks[1].getFill(), tanks[1].getMaxFill(),
tanks[2].getFill(), tanks[2].getMaxFill(),
tanks[3].getFill(), tanks[3].getMaxFill()};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineTurbineGas(player.inventory, this);

View File

@ -7,8 +7,13 @@ import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyUser;
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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -19,7 +24,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class TileEntityMicrowave extends TileEntityMachineBase implements IEnergyUser, IGUIProvider {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMicrowave extends TileEntityMachineBase implements IEnergyUser, IGUIProvider, SimpleComponent {
public long power;
public static final long maxPower = 50000;
@ -209,6 +215,17 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IEnerg
nbt.setInteger("speed", speed);
}
@Override
public String getComponentName() {
return "microwave";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] test(Context context, Arguments args) {
return new Object[] {"This is a testing device for everything OC."};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMicrowave(player.inventory, this);

View File

@ -25,8 +25,13 @@ import com.hbm.util.EnumUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import api.hbm.fluid.IFluidStandardTransceiver;
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.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
@ -37,7 +42,8 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IFluidStandardTransceiver {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, SimpleComponent, IFluidStandardTransceiver {
public FluidTank[] tanks;
public int coreHeat;
@ -521,6 +527,43 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
}
}
public String getComponentName() {
return "ntm_pwr_control";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {coreHeat, hullHeat};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFlux(Context context, Arguments args) {
return new Object[] {flux};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getLevel(Context context, Arguments args) {
return new Object[] {rodTarget};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {coreHeat, hullHeat, flux, rodTarget};
}
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setLevel(Context context, Arguments args) {
rodTarget = MathHelper.clamp_int(args.checkInteger(0), 0, 100);
this.markChanged();
return new Object[] {true};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerPWR(player.inventory, this);

View File

@ -256,56 +256,35 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I
return "reactor_control";
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] isLinked(Context context, Arguments args) {
return new Object[] {isLinked};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getReactor(Context context, Arguments args) {
return new Object[] {getDisplayData()};
}
@Callback
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setParams(Context context, Arguments args) { //i hate my life
int newFunction = args.checkInteger(0);
double newMaxheat = args.checkDouble(1);
double newMinheat = args.checkDouble(2);
double newMaxlevel = args.checkDouble(3)/100.0;
double newMinlevel = args.checkDouble(4)/100.0;
if (newFunction > 2) { //no more out of bounds for you (and yes there's integer values for functions, sue me)
newFunction = 0;
} else if (newFunction < 0) {
newFunction = 0;
}
if (newMaxheat < 0.0) {
newMaxheat = 0.0;
}
if (newMinheat < 0.0) {
newMinheat = 0.0;
}
if (newMaxlevel < 0.0) {
newMaxlevel = 0.0;
} else if (newMaxlevel > 1.0) {
newMaxlevel = 1.0;
}
if (newMinlevel < 0.0) {
newMinlevel = 0.0;
} else if (newMinlevel > 1.0) {
newMinlevel = 1.0;
}
function = RodFunction.values()[newFunction];
heatUpper = newMaxheat;
heatLower = newMinheat;
levelUpper = newMaxlevel;
levelLower = newMinlevel;
double newMaxHeat = args.checkDouble(1);
double newMinHeat = args.checkDouble(2);
double newMaxLevel = args.checkDouble(3)/100.0;
double newMinLevel = args.checkDouble(4)/100.0;
function = RodFunction.values()[MathHelper.clamp_int(newFunction, 0, 2)];
heatUpper = MathHelper.clamp_double(newMaxHeat, 0, 9999);
heatLower = MathHelper.clamp_double(newMinHeat, 0, 9999);
levelUpper = MathHelper.clamp_double(newMaxLevel, 0, 1);
levelLower = MathHelper.clamp_double(newMinLevel, 0, 1);
return new Object[] {};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getParams(Context context, Arguments args) {
return new Object[] {function.ordinal(), heatUpper, heatLower, levelUpper, levelLower};

View File

@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -395,46 +396,41 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements
return "research_reactor";
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTemp(Context context, Arguments args) { // or getHeat, whatever.
return new Object[] {heat};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getLevel(Context context, Arguments args) {
return new Object[] {level * 100};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTargetLevel(Context context, Arguments args) {
return new Object[] {targetLevel};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFlux(Context context, Arguments args) {
return new Object[] {totalFlux};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, level, targetLevel, totalFlux};
}
@Callback
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setLevel(Context context, Arguments args) {
double newLevel = args.checkDouble(0)/100.0;
if (newLevel > 1.0) {
newLevel = 1.0;
} else if (newLevel < 0.0) {
newLevel = 0.0;
}
targetLevel = newLevel;
targetLevel = MathHelper.clamp_double(newLevel, 0, 100.0);
return new Object[] {};
}

View File

@ -545,49 +545,49 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
return "zirnox_reactor";
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTemp(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPressure(Context context, Arguments args) {
return new Object[] {pressure};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getWater(Context context, Arguments args) {
return new Object[] {water.getFill()};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getSteam(Context context, Arguments args) {
return new Object[] {steam.getFill()};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCarbonDioxide(Context context, Arguments args) {
return new Object[] {carbonDioxide.getFill()};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] isActive(Context context, Arguments args) {
return new Object[] {isOn};
}
@Callback
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, pressure, water.getFill(), steam.getFill(), carbonDioxide.getFill(), isOn};
}
@Callback
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setActive(Context context, Arguments args) {
isOn = args.checkBoolean(0);

View File

@ -339,12 +339,13 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
return "rbmk_crane";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true, limit = 2) //yknow computers are more efficient than humans, lets give an incentive to use OC
@Optional.Method(modid = "OpenComputers")
public Object[] move(Context context, Arguments args) {
if(setUpCrane) {
String textbruh = args.checkString(0);
switch(textbruh) {
String direction = args.checkString(0);
switch(direction) {
case "up":
tiltFront = 30;
if(!worldObj.isRemote) posFront += speed;
@ -368,7 +369,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
return new Object[] {"Crane not found"};
}
@Callback(direct = true, limit = 4)
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] load(Context context, Arguments args) {
if (setUpCrane) {
@ -378,7 +379,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
return new Object[] {"Crane not found"};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getDepletion(Context context, Arguments args) {
if(loadedItem != null && loadedItem.getItem() instanceof ItemRBMKRod) {
@ -387,7 +388,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getXenonPoison(Context context, Arguments args) {
if(loadedItem != null && loadedItem.getItem() instanceof ItemRBMKRod) {
@ -395,4 +396,14 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
}
return new Object[] {"N/A"};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers") //if this doesnt work im going to die
public Object[] getCranePos(Context context, Arguments args) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection left = dir.getRotation(ForgeDirection.DOWN);
int x = (int)Math.floor(this.centerX - dir.offsetX * this.posFront - left.offsetX * this.posLeft + 0.5D);
int z = (int)Math.floor(this.centerZ - dir.offsetZ * this.posFront - left.offsetZ * this.posLeft + 0.5D);
return new Object[] {x, z};
}
}

View File

@ -5,6 +5,7 @@ import api.hbm.fluid.IFluidUser;
import api.hbm.fluid.IPipeNet;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
import com.hbm.handler.CompatHandler;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
@ -335,87 +336,60 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
public String getComponentName() {
return "rbmk_boiler";
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getSteam(Context context, Arguments args) {
return new Object[] {steam.getFill()};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getSteamMax(Context context, Arguments args) {
return new Object[] {steam.getMaxFill()};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getWater(Context context, Arguments args) {
return new Object[] {feed.getFill()};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getWaterMax(Context context, Arguments args) {
return new Object[] {feed.getMaxFill()};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
FluidType type = steam.getTankType();
Object type_1;
if(type == Fluids.STEAM) {type_1 = "0";}
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 = "Unknown Error";}
int type_1 = (int) CompatHandler.steamTypeToInt(steam.getTankType())[0];
return new Object[] {heat, steam.getFill(), steam.getMaxFill(), feed.getFill(), feed.getMaxFill(), type_1, xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getSteamType(Context context, Arguments args) {
FluidType type = steam.getTankType();
if(type == Fluids.STEAM) {return new Object[] {0};}
else if(type == Fluids.HOTSTEAM) {return new Object[] {1};}
else if(type == Fluids.SUPERHOTSTEAM) {return new Object[] {2};}
else if(type == Fluids.ULTRAHOTSTEAM) {return new Object[] {3};}
else {return new Object[] {"Unknown Error"};}
return CompatHandler.steamTypeToInt(steam.getTankType());
}
@Callback(direct = true, limit = 16)
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setSteamType(Context context, Arguments args) {
int type = args.checkInteger(0);
if(type > 3) {
type = 3;
} else if(type < 0) {
type = 0;
}
if(type == 0) {
steam.setTankType(Fluids.STEAM);
return new Object[] {true};
} else if(type == 1) {
steam.setTankType(Fluids.HOTSTEAM);
return new Object[] {true};
} else if(type == 2) {
steam.setTankType(Fluids.SUPERHOTSTEAM);
return new Object[] {true};
} else {
steam.setTankType(Fluids.ULTRAHOTSTEAM);
return new Object[] {true};
}
steam.setTankType(CompatHandler.intToSteamType(type));
return new Object[] {true};
}
@Override

View File

@ -9,6 +9,7 @@ import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase implements SimpleComponent {
@ -126,46 +127,41 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im
return "rbmk_control_rod";
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getLevel(Context context, Arguments args) {
return new Object[] {getMult() * 100};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTargetLevel(Context context, Arguments args) {
return new Object[] {targetLevel * 100};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, getMult() * 100, targetLevel * 100, xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true, limit = 4)
@Optional.Method(modid = "OpenComputers")
public Object[] setLevel(Context context, Arguments args) {
double newLevel = args.checkDouble(0)/100.0;
if (newLevel > 1.0) {
newLevel = 1.0;
} else if (newLevel < 0.0) {
newLevel = 0.0;
}
targetLevel = newLevel;
targetLevel = MathHelper.clamp_double(newLevel, 0, 1);
return new Object[] {};
}
}

View File

@ -133,7 +133,7 @@ public class TileEntityRBMKControlManual extends TileEntityRBMKControl implement
return data;
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getColor(Context context, Arguments args) {
return new Object[] {this.color};

View File

@ -149,31 +149,31 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
return "rbmk_cooler";
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[]{heat};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCryo(Context context, Arguments args) {
return new Object[]{tank.getFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCryoMax(Context context, Arguments args) {
return new Object[]{tank.getMaxFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{heat, tank.getFill(), tank.getMaxFill(), xCoord, yCoord, zCoord};

View File

@ -281,54 +281,54 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
return "rbmk_heater";
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFill(Context context, Arguments args) {
return new Object[] {feed.getFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFillMax(Context context, Arguments args) {
return new Object[] {feed.getMaxFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getExport(Context context, Arguments args) {
return new Object[] {steam.getFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getExportMax(Context context, Arguments args) {
return new Object[] {steam.getMaxFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFillType(Context context, Arguments args) {
return new Object[] {feed.getTankType().getName()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getExportType(Context context, Arguments args) {
return new Object[] {steam.getTankType().getName()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, feed.getFill(), feed.getMaxFill(), steam.getFill(), steam.getMaxFill(), feed.getTankType().getName(), steam.getTankType().getName(), xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};

View File

@ -226,37 +226,37 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
return "rbmk_outgasser";
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getGas(Context context, Arguments args) {
return new Object[] {gas.getFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getGasMax(Context context, Arguments args) {
return new Object[] {gas.getMaxFill()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getGasType(Context context, Arguments args) {
return new Object[] {gas.getTankType().getID()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getProgress(Context context, Arguments args) {
return new Object[] {progress};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {gas.getFill(), gas.getMaxFill(), progress, gas.getTankType().getID(), xCoord, yCoord, zCoord};

View File

@ -389,25 +389,25 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return "rbmk_fuel_rod";
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluxSlow(Context context, Arguments args) {
return new Object[] {fluxSlow};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluxFast(Context context, Arguments args) {
return new Object[] {fluxFast};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getDepletion(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
@ -416,7 +416,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getXenonPoison(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
@ -425,7 +425,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoreHeat(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
@ -434,7 +434,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getSkinHeat(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
@ -443,34 +443,46 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {"N/A"};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getType(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
return new Object[] {slots[0].getItem().getUnlocalizedName()};
}
return new Object[] {"N/A"};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
Object OC_enrich_buf;
Object OC_poison_buf;
Object OC_hull_buf;
Object OC_core_buf;
String OC_type;
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
OC_enrich_buf = ItemRBMKRod.getEnrichment(slots[0]);
OC_poison_buf = ItemRBMKRod.getPoison(slots[0]);
OC_hull_buf = ItemRBMKRod.getHullHeat(slots[0]);
OC_core_buf = ItemRBMKRod.getCoreHeat(slots[0]);
OC_type = slots[0].getItem().getUnlocalizedName();
} else {
OC_enrich_buf = "N/A";
OC_poison_buf = "N/A";
OC_hull_buf = "N/A";
OC_core_buf = "N/A";
OC_type = "N/A";
}
return new Object[] {heat, OC_hull_buf, OC_core_buf, fluxSlow, fluxFast, OC_enrich_buf, OC_poison_buf, ((RBMKRod)this.getBlockType()).moderated, xCoord, yCoord, zCoord};
return new Object[] {heat, OC_hull_buf, OC_core_buf, fluxSlow, fluxFast, OC_enrich_buf, OC_poison_buf, OC_type, ((RBMKRod)this.getBlockType()).moderated, xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getModerated(Context context, Arguments args) {
return new Object[] {((RBMKRod)this.getBlockType()).moderated};
}
@Callback(direct = true, limit = 16)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};

View File

@ -4,21 +4,15 @@ import com.hbm.inventory.container.ContainerRBMKStorage;
import com.hbm.inventory.gui.GUIRBMKStorage;
import com.hbm.items.machine.ItemRBMKRod;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements IRBMKLoadable, SimpleComponent {
public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements IRBMKLoadable {
public TileEntityRBMKStorage() {
super(12);
@ -91,35 +85,6 @@ public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements
slots[0] = null;
}
@Override
public String getComponentName() {
return "rbmk_storage_rod";
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getCoordinates(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getStored(Context context, Arguments args) {
return new Object[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5], slots[6], slots[7], slots[8], slots[9], slots[10], slots[11]};
}
@Callback(direct = true, limit = 8)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, slots[0], slots[1], slots[2], slots[3], slots[4], slots[5], slots[6], slots[7], slots[8], slots[9], slots[10], slots[11], xCoord, yCoord, zCoord};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKStorage(player.inventory, this);

View File

@ -393,25 +393,25 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
return "ntm_fluid_tank";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluidStored(Context context, Arguments args) {
return new Object[] {tank.getFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxStored(Context context, Arguments args) {
return new Object[] {tank.getMaxFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTypeStored(Context context, Arguments args) {
return new Object[] {tank.getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};

View File

@ -420,13 +420,13 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
return "ntm_energy_storage"; //ok if someone else can figure out how to do this that'd be nice (change the component name based on the type of storage block)
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getEnergyInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Callback(direct = true, limit = 8)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};

View File

@ -470,28 +470,28 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
@Override
public String getComponentName() {
return "ntm_tank";
return "ntm_fluid_tank";
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getFluidStored(Context context, Arguments args) {
return new Object[] {tank.getFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxStored(Context context, Arguments args) {
return new Object[] {tank.getMaxFill()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getTypeStored(Context context, Arguments args) {
return new Object[] {tank.getTankType().getName()};
}
@Callback(direct = true, limit = 4)
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};