diff --git a/changelog b/changelog index d831c9401..9be2b3edd 100644 --- a/changelog +++ b/changelog @@ -37,6 +37,11 @@ * There is now a second passive cooling variable used for rods on the inside (`dialPassiveCoolingInner`, 0.1°C/t by default) * The effective passive cooling value is scaled smoothly depending on how many sides are exposed, using `dialPassiveCoolingInner` with no exposed sides and `dialPassiveCooling` for rods with four exposed sides * Simply put, spindly RBMKs are now way less desirable, structural columns no longer just debuff the reactor and reactors that actually look like reactors are now more powerful +* Chanced the way RBMK coolers work + * Instead of using cryogel, coolers use 50mB of cold PFM per tick and return an equal amount of warm PFM + * In a 5x5 square around the cooler, all components are cooled down by 200°C per tick, down to a minimum of 20°C + * This renders that section of the reactor unsuitable for boiling water, however it means very high heat fuels can be used + * Cold PFM is used up at a steady rate, even if the reactor is already cold ## Fixed * Fixed NBTStack serialization omitting the stack size most of the time, preventing deserialization (mainly in the precision assembler config) @@ -46,4 +51,5 @@ * Fixed outdated info on the QMAW pages involving AA and BSCCO due to the fusion reactor update * Fixed ammo container giving 9mm instead of .22 for the akimbo target pistols * Fixed RBMK control rods incorrectly showing up in the red group when no group is set -* Fixed fluid output direction being incorrect on boilers, causing them to break with pipe anchors \ No newline at end of file +* Fixed fluid output direction being incorrect on boilers, causing them to break with pipe anchors +* Fixed an issue where the industrial turbine's tendency to round up the possible operation counter would cause it to use up steam it doesn't actually have diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityTurbineBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityTurbineBase.java index 7e4bedee8..aa76b01d1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityTurbineBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityTurbineBase.java @@ -59,7 +59,7 @@ public abstract class TileEntityTurbineBase extends TileEntityLoadedBase impleme double eff = trait.getEfficiency(CoolingType.TURBINE) * getEfficiency(); if(eff > 0) { tanks[1].setTankType(trait.coolsTo); - int inputOps = (int) Math.ceil((tanks[0].getFill() * consumptionPercent()) / trait.amountReq); + int inputOps = (int) (Math.min(Math.ceil(tanks[0].getFill() * consumptionPercent()), tanks[0].getFill()) / trait.amountReq); int outputOps = (tanks[1].getMaxFill() - tanks[1].getFill()) / trait.amountProduced; int ops = Math.min(inputOps, outputOps); if(ops > 0) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java index e485c2603..a0952b330 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java @@ -83,10 +83,10 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase { * Requires the amount of connected neighbors to scale cooling * @return */ - public double passiveCooling(int members) { + public double passiveCooling(int neighbors) { double min = RBMKDials.getPassiveCoolingInner(worldObj); //default: 0.1D double max = RBMKDials.getPassiveCooling(worldObj); //default: 1.0D - return min + (max - min) * ((4 - members) / 4D); + return min + (max - min) * ((4 - MathHelper.clamp_int(neighbors, 0, 4)) / 4D); } //necessary checks to figure out whether players are close enough to ensure that the reactor can be safely used @@ -222,7 +222,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase { } this.worldObj.theProfiler.endStartSection("rbmkBase_rpassive_cooling"); - coolPassively(members); + coolPassively(members - 1); this.worldObj.theProfiler.endSection(); } @@ -246,12 +246,9 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase { } } - protected void coolPassively(int members) { - - this.heat -= this.passiveCooling(members); - - if(heat < 20) - heat = 20D; + protected void coolPassively(int neighbors) { + this.heat -= this.passiveCooling(neighbors); + if(heat < 20) heat = 20D; } public RBMKType getRBMKType() { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java index fe3ddc71d..5227b0b81 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java @@ -1,135 +1,148 @@ package com.hbm.tileentity.machine.rbmk; -import api.hbm.fluid.IFluidStandardReceiver; +import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; + +import com.hbm.blocks.ModBlocks; import com.hbm.handler.CompatHandler; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; +import com.hbm.util.Compat; +import com.hbm.util.fauxpointtwelve.DirPos; + import cpw.mods.fml.common.Optional; import io.netty.buffer.ByteBuf; 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.entity.Entity; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; - -import java.util.List; +import net.minecraft.tileentity.TileEntity; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidStandardReceiver, SimpleComponent, CompatHandler.OCComponent { +public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidStandardTransceiverMK2, SimpleComponent, CompatHandler.OCComponent { - private FluidTank tank; - private int lastCooled; + protected int timer = 0; + private FluidTank[] tanks; + protected TileEntityRBMKBase[] neighborCache = new TileEntityRBMKBase[25]; public TileEntityRBMKCooler() { super(); - this.tank = new FluidTank(Fluids.CRYOGEL, 8_000); + this.tanks = new FluidTank[2]; + this.tanks[0] = new FluidTank(Fluids.PERFLUOROMETHYL_COLD, 4_000); + this.tanks[1] = new FluidTank(Fluids.PERFLUOROMETHYL, 4_000); } @Override public void updateEntity() { - 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); - int cooling = Math.min(heatProvided, tank.getFill()); - - this.heat -= cooling; - this.tank.setFill(this.tank.getFill() - cooling); - - this.lastCooled = cooling; - - if (lastCooled > 0) { - List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 4, zCoord, xCoord + 1, yCoord + 8, zCoord + 1)); - - for (Entity e : entities) { - e.setFire(5); - e.attackEntityFrom(DamageSource.inFire, 10); + if(!worldObj.isRemote) { + + if(timer <= 0) { + timer = 60; + + for(int i = 0; i < 25; i++) { + int x = xCoord - 2 + i / 5; + int z = zCoord - 2 + i % 5; + TileEntity tile = Compat.getTileStandard(worldObj, x, yCoord, z); + if(tile instanceof TileEntityRBMKBase) { + neighborCache[i] = (TileEntityRBMKBase) tile; + } else { + neighborCache[i] = null; } } + } else { - this.lastCooled = 0; + timer--; + } + + if(tanks[0].getFill() >= 50 && tanks[1].getMaxFill() - tanks[1].getFill() >= 50) { + tanks[0].setFill(tanks[0].getFill() - 50); + tanks[1].setFill(tanks[1].getFill() + 50); + + for(TileEntityRBMKBase neighbor : neighborCache) { + if(neighbor != null) { + neighbor.heat -= 200; + if(neighbor.heat < 20) neighbor.heat = 20; + } + } } - } else { - - 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) - 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++) { - 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) - 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); - + this.trySubscribe(tanks[0].getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); + + if(this.tanks[1].getFill() > 0) for(DirPos pos : getOutputPos()) { + this.tryProvide(this.tanks[1], worldObj, pos); } + } super.updateEntity(); } + protected DirPos[] getOutputPos() { + + if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) { + return new DirPos[] { + new DirPos(this.xCoord, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y), + new DirPos(this.xCoord + 1, this.yCoord - 1, this.zCoord, Library.POS_X), + new DirPos(this.xCoord - 1, this.yCoord - 1, this.zCoord, Library.NEG_X), + new DirPos(this.xCoord, this.yCoord - 1, this.zCoord + 1, Library.POS_Z), + new DirPos(this.xCoord, this.yCoord - 1, this.zCoord - 1, Library.NEG_Z), + new DirPos(this.xCoord, this.yCoord - 2, this.zCoord, Library.NEG_Y) + }; + } else if(worldObj.getBlock(xCoord, yCoord - 2, zCoord) == ModBlocks.rbmk_loader) { + return new DirPos[] { + new DirPos(this.xCoord, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y), + new DirPos(this.xCoord + 1, this.yCoord - 2, this.zCoord, Library.POS_X), + new DirPos(this.xCoord - 1, this.yCoord - 2, this.zCoord, Library.NEG_X), + new DirPos(this.xCoord, this.yCoord - 2, this.zCoord + 1, Library.POS_Z), + new DirPos(this.xCoord, this.yCoord - 2, this.zCoord - 1, Library.NEG_Z), + new DirPos(this.xCoord, this.yCoord - 3, this.zCoord, Library.NEG_Y) + }; + } else { + return new DirPos[] { + new DirPos(this.xCoord, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y) + }; + } + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - tank.readFromNBT(nbt, "cryo"); - this.lastCooled = nbt.getInteger("cooled"); + tanks[0].readFromNBT(nbt, "t0"); + tanks[1].readFromNBT(nbt, "t1"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - tank.writeToNBT(nbt, "cryo"); - nbt.setInteger("cooled", this.lastCooled); + tanks[0].writeToNBT(nbt, "t0"); + tanks[1].writeToNBT(nbt, "t1"); } @Override public void serialize(ByteBuf buf) { super.serialize(buf); - this.tank.serialize(buf); - buf.writeInt(this.lastCooled); + this.tanks[0].serialize(buf); + this.tanks[1].serialize(buf); } @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); - this.tank.deserialize(buf); - this.lastCooled = buf.readInt(); + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); } - @Override - public ColumnType getConsoleType() { - return ColumnType.COOLER; - } + @Override public ColumnType getConsoleType() { return ColumnType.COOLER; } - @Override - public FluidTank[] getAllTanks() { - return new FluidTank[]{tank}; - } - - @Override - public FluidTank[] getReceivingTanks() { - return new FluidTank[]{tank}; - } + @Override public FluidTank[] getAllTanks() { return tanks; } + @Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; } + @Override public FluidTank[] getSendingTanks() { return new FluidTank[] {tanks[1]}; } //do some opencomputers stuff @@ -143,28 +156,6 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidSt public Object[] getHeat(Context context, Arguments args) { return new Object[]{heat}; } - - @Callback(direct = true) - @Optional.Method(modid = "OpenComputers") - public Object[] getCryo(Context context, Arguments args) { - return new Object[]{tank.getFill()}; - } - - @Callback(direct = true) - @Optional.Method(modid = "OpenComputers") - public Object[] getCryoMax(Context context, Arguments args) { - return new Object[]{tank.getMaxFill()}; - } - - @Callback(direct = true) - @Optional.Method(modid = "OpenComputers") - public Object[] getCoordinates(Context context, Arguments args) { - return new Object[] {xCoord, yCoord, zCoord}; - } - - @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}; - } + + // don't know shit about OC - someone else has to add those back } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java index dcc6b09f1..08397ddb2 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java @@ -1,6 +1,7 @@ package com.hbm.tileentity.machine.rbmk; -import api.hbm.fluid.IFluidStandardTransceiver; +import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; + import com.hbm.blocks.ModBlocks; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; import com.hbm.handler.CompatHandler; @@ -28,7 +29,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) -public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidStandardTransceiver, SimpleComponent, CompatHandler.OCComponent { +public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidStandardTransceiverMK2, SimpleComponent, CompatHandler.OCComponent { public FluidTank feed; public FluidTank steam; @@ -82,7 +83,7 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); for(DirPos pos : getOutputPos()) { - if(this.steam.getFill() > 0) this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + if(this.steam.getFill() > 0) this.tryProvide(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_absorber_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_absorber_cover_top.png index c530221bd..7f3357c8b 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_absorber_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_absorber_cover_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_cooler_side.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_cooler_side.png index 049df5f31..c56557fb9 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_cooler_side.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_cooler_side.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_cover_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_cover_top.png index 609cfa25c..fb129290d 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_cover_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_cover_top.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_top.png b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_top.png index 6629480e9..66d4f5068 100644 Binary files a/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_top.png and b/src/main/resources/assets/hbm/textures/blocks/rbmk/rbmk_moderator_top.png differ