Merge pull request #953 from BallOfEnergy1/master

Added OC compatibility
This commit is contained in:
HbmMods 2023-03-17 07:52:09 +01:00 committed by GitHub
commit bab2fbc211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 358 additions and 42 deletions

View File

@ -335,6 +335,12 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
return new Object[] {watts}; return new Object[] {watts};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower(), tank.getFill(), watts, isOn};
}
@Callback @Callback
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public Object[] isActive(Context context, Arguments args) { public Object[] isActive(Context context, Arguments args) {

View File

@ -212,6 +212,12 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
return new Object[] {tanks[1].getFill()}; return new Object[] {tanks[1].getFill()};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerCoreInjector(player.inventory, this); return new ContainerCoreInjector(player.inventory, this);

View File

@ -209,6 +209,12 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
return new Object[] {tank.getFill()}; return new Object[] {tank.getFill()};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {joules, power, tank.getFill()};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerCoreReceiver(player.inventory, this); return new ContainerCoreReceiver(player.inventory, this);

View File

@ -200,6 +200,18 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
return new Object[] {"N/A"}; return new Object[] {"N/A"};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
Object lens_damage_buf;
if(slots[0] != null && slots[0].getItem() == ModItems.ams_lens && ItemLens.getLensDamage(slots[0]) < ((ItemLens)ModItems.ams_lens).maxDamage) {
lens_damage_buf = ItemLens.getLensDamage(slots[0]);
} else {
lens_damage_buf = "N/A";
}
return new Object[] {power, maxPower, watts, lens_damage_buf};
}
@Callback @Callback
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public Object[] setInput(Context context, Arguments args) { public Object[] setInput(Context context, Arguments args) {

View File

@ -14,6 +14,8 @@ import com.hbm.tileentity.TileEntityTickingBase;
import api.hbm.energy.IEnergyUser; import api.hbm.energy.IEnergyUser;
import api.hbm.entity.IRadarDetectable; import api.hbm.entity.IRadarDetectable;
import api.hbm.entity.IRadarDetectable.RadarTargetType; import api.hbm.entity.IRadarDetectable.RadarTargetType;
import cpw.mods.fml.client.config.GuiEditArrayEntries;
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 net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
@ -25,8 +27,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
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;
public class TileEntityMachineRadar extends TileEntityTickingBase implements IEnergyUser, IGUIProvider { @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityMachineRadar extends TileEntityTickingBase implements IEnergyUser, IGUIProvider, SimpleComponent {
public List<Entity> entList = new ArrayList(); public List<Entity> entList = new ArrayList();
public List<int[]> nearbyMissiles = new ArrayList(); public List<int[]> nearbyMissiles = new ArrayList();
@ -285,6 +292,44 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
return 65536.0D; return 65536.0D;
} }
// do some opencomputer stuff
@Override
public String getComponentName() {
return "ntm_radar";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getPower(Context context, Arguments args) {
return new Object[] {power};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] isJammed(Context context, Arguments args) {
return new Object[] {jammed};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getEntities(Context context, Arguments args) {
int index = args.checkInteger(0);
boolean raw = args.checkBoolean(1);
if(!raw && !jammed) {
Entity e = entList.get(index);
double a = (e.posX);
double b = (e.posY);
double c = (e.posZ);
boolean d = (e instanceof EntityPlayer);
return new Object[] {a, b, c, d};
} else if (!jammed) {
return new Object[] {entList};
} else {
return new Object[] {"Radar jammed!"};
}
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineRadar(player.inventory, this); return new ContainerMachineRadar(player.inventory, this);

View File

@ -233,6 +233,12 @@ public class TileEntityMachineReactorBreeding extends TileEntityMachineBase impl
return new Object[] {progress}; return new Object[] {progress};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {flux, progress};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMachineReactorBreeding(player.inventory, this); return new ContainerMachineReactorBreeding(player.inventory, this);

View File

@ -415,6 +415,12 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements
return new Object[] {totalFlux}; return new Object[] {totalFlux};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, level, targetLevel, totalFlux};
}
@Callback @Callback
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public Object[] setLevel(Context context, Arguments args) { public Object[] setLevel(Context context, Arguments args) {

View File

@ -581,6 +581,12 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
return new Object[] {isOn}; return new Object[] {isOn};
} }
@Callback
@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
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public Object[] setActive(Context context, Arguments args) { public Object[] setActive(Context context, Arguments args) {

View File

@ -361,6 +361,52 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
return new Object[] {feed.getMaxFill()}; return new Object[] {feed.getMaxFill()};
} }
@Callback
@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";}
return new Object[] {heat, steam.getFill(), steam.getMaxFill(), feed.getFill(), feed.getMaxFill(), type_1};
}
@Callback
@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"};}
}
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"};
}
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKGeneric(player.inventory); return new ContainerRBMKGeneric(player.inventory);

View File

@ -147,6 +147,12 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im
return new Object[] {heat}; return new Object[] {heat};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {heat, getMult() * 100, targetLevel * 100};
}
@Callback @Callback
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public Object[] setLevel(Context context, Arguments args) { public Object[] setLevel(Context context, Arguments args) {

View File

@ -10,12 +10,19 @@ import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import li.cil.oc.api.network.SimpleComponent;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
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;
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor, IFluidStandardReceiver { @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor, IFluidStandardReceiver, SimpleComponent {
private FluidTank tank; private FluidTank tank;
private int lastCooled; private int lastCooled;
@ -29,14 +36,14 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
@Override @Override
public void updateEntity() { public void updateEntity() {
if(!worldObj.isRemote) { if (!worldObj.isRemote) {
if(this.worldObj.getTotalWorldTime() % 20 == 0) if (this.worldObj.getTotalWorldTime() % 20 == 0)
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
if((int)(this.heat) > 750) { if ((int) (this.heat) > 750) {
int heatProvided = (int)(this.heat - 750D); int heatProvided = (int) (this.heat - 750D);
int cooling = Math.min(heatProvided, tank.getFill()); int cooling = Math.min(heatProvided, tank.getFill());
this.heat -= cooling; this.heat -= cooling;
@ -44,10 +51,10 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
this.lastCooled = cooling; this.lastCooled = cooling;
if(lastCooled > 0) { if (lastCooled > 0) {
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 4, zCoord, xCoord + 1, yCoord + 8, zCoord + 1)); List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 4, zCoord, xCoord + 1, yCoord + 8, zCoord + 1));
for(Entity e : entities) { for (Entity e : entities) {
e.setFire(5); e.setFire(5);
e.attackEntityFrom(DamageSource.inFire, 10); e.attackEntityFrom(DamageSource.inFire, 10);
} }
@ -58,21 +65,21 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
} else { } else {
if(this.lastCooled > 100) { if (this.lastCooled > 100) {
for(int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
worldObj.spawnParticle("flame", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0); worldObj.spawnParticle("flame", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0);
worldObj.spawnParticle("smoke", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0); worldObj.spawnParticle("smoke", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0);
} }
if(worldObj.rand.nextInt(20) == 0) if (worldObj.rand.nextInt(20) == 0)
worldObj.spawnParticle("lava", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.0, 0); worldObj.spawnParticle("lava", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.0, 0);
} else if(this.lastCooled > 50) { } else if (this.lastCooled > 50) {
for(int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
worldObj.spawnParticle("cloud", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, worldObj.rand.nextGaussian() * 0.05, 0.2, worldObj.rand.nextGaussian() * 0.05); worldObj.spawnParticle("cloud", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, worldObj.rand.nextGaussian() * 0.05, 0.2, worldObj.rand.nextGaussian() * 0.05);
} }
} else if(this.lastCooled > 0) { } else if (this.lastCooled > 0) {
if(worldObj.getTotalWorldTime() % 2 == 0) if (worldObj.getTotalWorldTime() % 2 == 0)
worldObj.spawnParticle("cloud", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0); worldObj.spawnParticle("cloud", xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 4.5, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, 0, 0.2, 0);
} }
@ -109,7 +116,7 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
@Override @Override
public void setFluidFill(int fill, FluidType type) { public void setFluidFill(int fill, FluidType type) {
if(type == tank.getTankType()) if (type == tank.getTankType())
tank.setFill(fill); tank.setFill(fill);
} }
@ -130,12 +137,41 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
@Override @Override
public FluidTank[] getAllTanks() { public FluidTank[] getAllTanks() {
return new FluidTank[] {tank}; return new FluidTank[]{tank};
} }
@Override @Override
public FluidTank[] getReceivingTanks() { public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tank}; return new FluidTank[]{tank};
} }
//do some opencomputers stuff
public String getComponentName() {
return "rbmk_cooler";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[]{heat};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCryo(Context context, Arguments args) {
return new Object[]{tank.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCryoMax(Context context, Arguments args) {
return new Object[]{tank.getMaxFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[]{heat, tank.getFill(), tank.getMaxFill()};
}
} }

View File

@ -27,8 +27,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
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;
public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver { @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver, SimpleComponent {
public FluidTank feed; public FluidTank feed;
public FluidTank steam; public FluidTank steam;
@ -268,6 +274,60 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
return new FluidTank[] {feed}; return new FluidTank[] {feed};
} }
//opencomputers stuff
@Override
public String getComponentName() {
return "rbmk_heater";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {heat};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getFill(Context context, Arguments args) {
return new Object[] {feed.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getFillMax(Context context, Arguments args) {
return new Object[] {feed.getMaxFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getExport(Context context, Arguments args) {
return new Object[] {steam.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getExportMax(Context context, Arguments args) {
return new Object[] {steam.getMaxFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getFillType(Context context, Arguments args) {
return new Object[] {feed.getTankType().getID()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getExportType(Context context, Arguments args) {
return new Object[] {steam.getTankType().getID()};
}
@Callback
@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().getID(), steam.getTankType().getID()};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKHeater(player.inventory, this); return new ContainerRBMKHeater(player.inventory, this);

View File

@ -14,8 +14,13 @@ import com.hbm.util.Tuple.Pair;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardSender; import api.hbm.fluid.IFluidStandardSender;
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.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -23,7 +28,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IFluidStandardSender { @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IFluidStandardSender, SimpleComponent {
public FluidTank gas; public FluidTank gas;
public double progress; public double progress;
@ -215,6 +221,36 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
return new FluidTank[] {gas}; return new FluidTank[] {gas};
} }
//do some opencomputers stuff
@Override
public String getComponentName() {
return "rbmk_outgasser";
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getGas(Context context, Arguments args) {
return new Object[] {gas.getFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getGasMax(Context context, Arguments args) {
return new Object[] {gas.getMaxFill()};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getProgress(Context context, Arguments args) {
return new Object[] {progress};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {gas.getFill(), gas.getMaxFill(), progress};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKOutgasser(player.inventory, this); return new ContainerRBMKOutgasser(player.inventory, this);

View File

@ -421,6 +421,39 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
return new Object[] {"N/A"}; return new Object[] {"N/A"};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getCoreHeat(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
return new Object[] {ItemRBMKRod.getCoreHeat(slots[0])};
}
return new Object[] {"N/A"};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getSkinHeat(Context context, Arguments args) {
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
return new Object[] {ItemRBMKRod.getHullHeat(slots[0])};
}
return new Object[] {"N/A"};
}
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
Object OC_enrich_buf;
Object OC_poison_buf;
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
OC_enrich_buf = ItemRBMKRod.getEnrichment(slots[0]);
OC_poison_buf = ItemRBMKRod.getPoison(slots[0]);
} else {
OC_enrich_buf = "N/A";
OC_poison_buf = "N/A";
}
return new Object[] {heat, fluxSlow, fluxFast, OC_enrich_buf, OC_poison_buf};
}
@Override @Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerRBMKRod(player.inventory, this); return new ContainerRBMKRod(player.inventory, this);

View File

@ -388,6 +388,12 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
return new Object[] {getMaxPower()}; return new Object[] {getMaxPower()};
} }
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {getPower(), getMaxPower()};
}
@Override @Override
public void writeNBT(NBTTagCompound nbt) { public void writeNBT(NBTTagCompound nbt) {
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();