mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Revamped some Opencomputers stuff
This commit is contained in:
parent
ce0b31d536
commit
edb94e966f
@ -361,6 +361,11 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
return new Object[] {feed.getMaxFill()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {heat, steam.getFill(), steam.getMaxFill(), feed.getFill(), feed.getMaxFill()};
|
||||
}
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerRBMKGeneric(player.inventory);
|
||||
|
||||
@ -147,6 +147,12 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im
|
||||
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
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setLevel(Context context, Arguments args) {
|
||||
|
||||
@ -10,44 +10,51 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
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;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor, IFluidStandardReceiver, SimpleComponent {
|
||||
|
||||
public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
private FluidTank tank;
|
||||
private int lastCooled;
|
||||
|
||||
|
||||
public TileEntityRBMKCooler() {
|
||||
super();
|
||||
|
||||
|
||||
this.tank = new FluidTank(Fluids.CRYOGEL, 8000, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.worldObj.getTotalWorldTime() % 20 == 0)
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
if (this.worldObj.getTotalWorldTime() % 20 == 0)
|
||||
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
|
||||
if((int)(this.heat) > 750) {
|
||||
|
||||
int heatProvided = (int)(this.heat - 750D);
|
||||
|
||||
if ((int) (this.heat) > 750) {
|
||||
|
||||
int heatProvided = (int) (this.heat - 750D);
|
||||
int cooling = Math.min(heatProvided, tank.getFill());
|
||||
|
||||
|
||||
this.heat -= cooling;
|
||||
this.tank.setFill(this.tank.getFill() - 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));
|
||||
|
||||
for(Entity e : entities) {
|
||||
|
||||
for (Entity e : entities) {
|
||||
e.setFire(5);
|
||||
e.attackEntityFrom(DamageSource.inFire, 10);
|
||||
}
|
||||
@ -55,44 +62,44 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
|
||||
} else {
|
||||
this.lastCooled = 0;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(this.lastCooled > 100) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
|
||||
if (this.lastCooled > 100) {
|
||||
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("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);
|
||||
} else if(this.lastCooled > 50) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
} else if (this.lastCooled > 50) {
|
||||
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);
|
||||
}
|
||||
} else if(this.lastCooled > 0) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 2 == 0)
|
||||
} else if (this.lastCooled > 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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
|
||||
tank.readFromNBT(nbt, "cryo");
|
||||
this.lastCooled = nbt.getInteger("cooled");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
|
||||
tank.writeToNBT(nbt, "cryo");
|
||||
nbt.setInteger("cooled", this.lastCooled);
|
||||
}
|
||||
@ -109,7 +116,7 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int fill, FluidType type) {
|
||||
if(type == tank.getTankType())
|
||||
if (type == tank.getTankType())
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@ -130,12 +137,23 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidAc
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
return new FluidTank[]{tank};
|
||||
}
|
||||
|
||||
@Override
|
||||
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[] getInfo(Context context, Arguments args) {
|
||||
return new Object[]{heat, tank.getMaxFill(), tank.getFill()};
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,13 @@ import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardSender;
|
||||
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;
|
||||
@ -23,7 +28,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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 double progress;
|
||||
@ -215,6 +221,17 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
||||
return new FluidTank[] {gas};
|
||||
}
|
||||
|
||||
//do some opencomputers stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "rbmk_outgasser";
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {gas.getFill(), gas.getMaxFill(), progress};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerRBMKOutgasser(player.inventory, this);
|
||||
|
||||
@ -420,6 +420,20 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
}
|
||||
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
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user