mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
i want to kill myself ❤️
This commit is contained in:
parent
8b5bfda162
commit
bc0d1059d8
@ -3,7 +3,8 @@ package com.hbm.blocks.machine.rbmk;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemRBMKLid;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -29,8 +30,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import static com.hbm.handler.rbmkmk2.RBMKHandler.getNode;
|
||||
|
||||
public abstract class RBMKBase extends BlockDummyable implements IToolable, ILookOverlay {
|
||||
|
||||
public static boolean dropLids = true;
|
||||
@ -175,7 +174,7 @@ public abstract class RBMKBase extends BlockDummyable implements IToolable, ILoo
|
||||
|
||||
if(rbmk.hasLid() && rbmk.isLidRemovable()) {
|
||||
|
||||
RBMKHandler.RBMKNode node = getNode(new BlockPos(te));
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(new BlockPos(te));
|
||||
if (node != null)
|
||||
node.removeLid();
|
||||
|
||||
|
||||
20
src/main/java/com/hbm/handler/neutron/NeutronNode.java
Normal file
20
src/main/java/com/hbm/handler/neutron/NeutronNode.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
import com.hbm.handler.neutron.NeutronStream.NeutronType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class NeutronNode {
|
||||
|
||||
protected NeutronType type;
|
||||
protected TileEntity tile;
|
||||
// like NBT but less fucking CANCER
|
||||
protected Map<String, Object> data = new HashMap<>();
|
||||
|
||||
public NeutronNode(TileEntity tile, NeutronType type) {
|
||||
this.type = type;
|
||||
this.tile = tile;
|
||||
}
|
||||
}
|
||||
62
src/main/java/com/hbm/handler/neutron/NeutronNodeWorld.java
Normal file
62
src/main/java/com/hbm/handler/neutron/NeutronNodeWorld.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class NeutronNodeWorld {
|
||||
// HashMap of all RBMK nodes and their positions.
|
||||
protected static HashMap<BlockPos, NeutronNode> nodeCache = new HashMap<>();
|
||||
|
||||
public static void addNode(NeutronNode node) {
|
||||
nodeCache.put(new BlockPos(node.tile), node);
|
||||
}
|
||||
|
||||
public static void removeNode(BlockPos position) {
|
||||
nodeCache.remove(position);
|
||||
}
|
||||
|
||||
public static NeutronNode getNode(BlockPos position) {
|
||||
return nodeCache.get(position);
|
||||
}
|
||||
|
||||
public static void removeAllNodes() {
|
||||
nodeCache.clear();
|
||||
}
|
||||
|
||||
// List of all stream worlds.
|
||||
public static HashMap<World, StreamWorld> streamWorlds = new HashMap<>();
|
||||
|
||||
public static class StreamWorld {
|
||||
|
||||
List<NeutronStream> streams;
|
||||
|
||||
public StreamWorld() {
|
||||
streams = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addStream(NeutronStream stream) {
|
||||
this.streams.add(stream);
|
||||
}
|
||||
|
||||
public void removeAllStreams() {
|
||||
this.streams.clear();
|
||||
}
|
||||
|
||||
public void removeAllStreamsOfType(NeutronStream.NeutronType type) {
|
||||
List<NeutronStream> toRemove = new ArrayList<>();
|
||||
for (NeutronStream stream : streams) {
|
||||
if (stream.type == type)
|
||||
toRemove.add(stream);
|
||||
}
|
||||
toRemove.forEach((stream) -> streams.remove(stream));
|
||||
}
|
||||
|
||||
public static void removeAllWorlds() {
|
||||
streamWorlds.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
69
src/main/java/com/hbm/handler/neutron/NeutronStream.java
Normal file
69
src/main/java/com/hbm/handler/neutron/NeutronStream.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld.StreamWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class NeutronStream {
|
||||
|
||||
public enum NeutronType {
|
||||
DUMMY, // Dummy streams for testing
|
||||
RBMK, // RBMK neutron streams
|
||||
PILE // Chicago pile streams
|
||||
}
|
||||
|
||||
public NeutronNode origin;
|
||||
|
||||
// doubles!!
|
||||
public double fluxQuantity;
|
||||
// Hey, new implementation! Basically a ratio for slow flux to fast flux
|
||||
// 0 = all slow flux
|
||||
// 1 = all fast flux
|
||||
public double fluxRatio;
|
||||
|
||||
public NeutronType type = NeutronType.DUMMY;
|
||||
|
||||
// Vector for direction of neutron flow.
|
||||
public Vec3 vector;
|
||||
|
||||
// Primarily used as a "dummy stream", not to be added to the streams list.
|
||||
public NeutronStream(NeutronNode origin, Vec3 vector) {
|
||||
this.origin = origin;
|
||||
this.vector = vector;
|
||||
}
|
||||
|
||||
public NeutronStream(NeutronNode origin, Vec3 vector, double flux, double ratio, NeutronType type) {
|
||||
this.origin = origin;
|
||||
this.vector = vector;
|
||||
this.fluxQuantity = flux;
|
||||
this.fluxRatio = ratio;
|
||||
this.type = type;
|
||||
World worldObj = origin.tile.getWorldObj();
|
||||
if (NeutronNodeWorld.streamWorlds.get(worldObj) == null) {
|
||||
StreamWorld world = new StreamWorld();
|
||||
world.addStream(this);
|
||||
NeutronNodeWorld.streamWorlds.put(worldObj, world);
|
||||
} else
|
||||
NeutronNodeWorld.streamWorlds.get(worldObj).addStream(this);
|
||||
}
|
||||
|
||||
// USES THE CACHE!!!
|
||||
public List<BlockPos> getBlocks(int range) {
|
||||
List<BlockPos> positions = new ArrayList<>();
|
||||
|
||||
for (int i = 1; i <= range; i++) {
|
||||
int x = (int) Math.floor(0.5 + vector.xCoord * i);
|
||||
int z = (int) Math.floor(0.5 + vector.zCoord * i);
|
||||
|
||||
BlockPos pos = new BlockPos(origin.tile).add(x, 0, z);
|
||||
positions.add(pos);
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
public abstract void runStreamInteraction(World worldObj);
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
import com.hbm.tileentity.machine.pile.TileEntityPileBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PileNeutronHandler {
|
||||
|
||||
public static class PileNeutronNode extends NeutronNode {
|
||||
|
||||
public PileNeutronNode(TileEntityPileBase tile) {
|
||||
super(tile, NeutronStream.NeutronType.RBMK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The big one!! Runs all interactions for neutrons.
|
||||
public static void runAllInteractions() {
|
||||
|
||||
// Remove `StreamWorld` objects if they have no streams.
|
||||
{ // aflghdkljghlkbhfjkghgilurbhlkfjghkffdjgn
|
||||
List<World> toRemove = new ArrayList<>();
|
||||
NeutronNodeWorld.streamWorlds.forEach((world, streamWorld) -> {
|
||||
if (streamWorld.streams.isEmpty())
|
||||
toRemove.add(world);
|
||||
});
|
||||
|
||||
for (World world : toRemove) {
|
||||
NeutronNodeWorld.streamWorlds.remove(world);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<World, NeutronNodeWorld.StreamWorld> world : NeutronNodeWorld.streamWorlds.entrySet()) {
|
||||
|
||||
for (NeutronStream stream : world.getValue().streams) {
|
||||
stream.runStreamInteraction(world.getKey());
|
||||
}
|
||||
world.getValue().removeAllStreams();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.handler.rbmkmk2;
|
||||
package com.hbm.handler.neutron;
|
||||
|
||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
@ -7,7 +7,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -16,7 +15,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RBMKHandler {
|
||||
public class RBMKNeutronHandler {
|
||||
|
||||
static double moderatorEfficiency;
|
||||
static double reflectorEfficiency;
|
||||
@ -38,30 +37,27 @@ public class RBMKHandler {
|
||||
return worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public static class RBMKNode {
|
||||
public static RBMKNeutronNode makeNode(TileEntityRBMKBase tile) {
|
||||
BlockPos pos = new BlockPos(tile);
|
||||
if (NeutronNodeWorld.nodeCache.containsKey(pos))
|
||||
return (RBMKNeutronNode) NeutronNodeWorld.getNode(pos);
|
||||
return new RBMKNeutronNode(tile, tile.getRBMKType(), tile.hasLid());
|
||||
}
|
||||
|
||||
protected RBMKType type;
|
||||
protected TileEntityRBMKBase tile;
|
||||
protected boolean hasLid;
|
||||
public static class RBMKNeutronNode extends NeutronNode {
|
||||
|
||||
public RBMKNode(TileEntityRBMKBase tile, RBMKType type) {
|
||||
this.type = type;
|
||||
this.tile = tile;
|
||||
this.hasLid = tile.hasLid();
|
||||
}
|
||||
|
||||
public RBMKNode(TileEntityRBMKBase tile, RBMKType type, boolean hasLid) {
|
||||
this.type = type;
|
||||
this.tile = tile;
|
||||
this.hasLid = hasLid;
|
||||
public RBMKNeutronNode(TileEntityRBMKBase tile, RBMKType type, boolean hasLid) {
|
||||
super(tile, NeutronStream.NeutronType.RBMK);
|
||||
this.data.put("hasLid", hasLid);
|
||||
this.data.put("type", type);
|
||||
}
|
||||
|
||||
public void addLid() {
|
||||
this.hasLid = true;
|
||||
this.data.replace("hasLid", true);
|
||||
}
|
||||
|
||||
public void removeLid() {
|
||||
this.hasLid = false;
|
||||
this.data.replace("hasLid", false);
|
||||
}
|
||||
|
||||
public List<BlockPos> getReaSimNodes() {
|
||||
@ -74,16 +70,15 @@ public class RBMKHandler {
|
||||
}
|
||||
|
||||
public List<BlockPos> checkNode() {
|
||||
|
||||
List<BlockPos> list = new ArrayList<>();
|
||||
|
||||
BlockPos pos = new BlockPos(this.tile);
|
||||
|
||||
List<NeutronStream> streams = new ArrayList<>();
|
||||
List<RBMKNeutronStream> streams = new ArrayList<>();
|
||||
|
||||
// Simulate streams coming out of the RBMK rod.
|
||||
for (ForgeDirection dir : TileEntityRBMKRod.fluxDirs) {
|
||||
streams.add(new NeutronStream(this, Vec3.createVectorHelper(dir.offsetX, 0, dir.offsetZ)));
|
||||
streams.add(new RBMKNeutronStream(this, Vec3.createVectorHelper(dir.offsetX, 0, dir.offsetZ)));
|
||||
}
|
||||
|
||||
// Check if the rod should uncache nodes.
|
||||
@ -91,7 +86,7 @@ public class RBMKHandler {
|
||||
TileEntityRBMKRod rod = (TileEntityRBMKRod) tile;
|
||||
if (!rod.hasRod || rod.lastFluxQuantity == 0) {
|
||||
|
||||
for (NeutronStream stream : streams) {
|
||||
for (RBMKNeutronStream stream : streams) {
|
||||
stream.getNodes(false).forEach(node -> list.add(new BlockPos(node.tile)));
|
||||
}
|
||||
|
||||
@ -112,16 +107,16 @@ public class RBMKHandler {
|
||||
|
||||
// Check if non-rod nodes should be uncached... but now with ReaSim!
|
||||
{ // Yeah, I don't want to contaminate the surrounding scope.
|
||||
List<RBMKNode> nodes = new ArrayList<>();
|
||||
List<RBMKNeutronNode> nodes = new ArrayList<>();
|
||||
points.forEach(nodePos -> {
|
||||
RBMKNode node = getNode(nodePos);
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(nodePos);
|
||||
if (node != null)
|
||||
nodes.add(node);
|
||||
});
|
||||
|
||||
boolean hasRod = false;
|
||||
|
||||
for (RBMKNode node : nodes) {
|
||||
for (RBMKNeutronNode node : nodes) {
|
||||
|
||||
if (node.tile instanceof TileEntityRBMKRod) {
|
||||
|
||||
@ -141,11 +136,11 @@ public class RBMKHandler {
|
||||
}
|
||||
|
||||
// Check if non-rod nodes should be uncached due to no rod in range.
|
||||
for (NeutronStream stream : streams) {
|
||||
for (RBMKNeutronStream stream : streams) {
|
||||
|
||||
List<RBMKNode> nodes = stream.getNodes(false);
|
||||
List<RBMKNeutronNode> nodes = stream.getNodes(false);
|
||||
|
||||
for (RBMKNode node : nodes) {
|
||||
for (RBMKNeutronNode node : nodes) {
|
||||
if (node.tile instanceof TileEntityRBMKRod)
|
||||
return list;
|
||||
}
|
||||
@ -162,84 +157,21 @@ public class RBMKHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static RBMKNode makeNode(TileEntityRBMKBase tile) {
|
||||
BlockPos pos = new BlockPos(tile);
|
||||
if (nodeCache.containsKey(pos))
|
||||
return getNode(pos);
|
||||
if (!tile.hasWorldObj())
|
||||
return new RBMKNode(tile, tile.getRBMKType(), true);
|
||||
return new RBMKNode(tile, tile.getRBMKType());
|
||||
}
|
||||
|
||||
public static class StreamWorld {
|
||||
public static class RBMKNeutronStream extends NeutronStream {
|
||||
|
||||
List<NeutronStream> streams;
|
||||
|
||||
public StreamWorld() {
|
||||
streams = new ArrayList<>();
|
||||
public RBMKNeutronStream(NeutronNode origin, Vec3 vector) {
|
||||
super(origin, vector);
|
||||
}
|
||||
|
||||
public void addStream(NeutronStream stream) {
|
||||
this.streams.add(stream);
|
||||
}
|
||||
|
||||
public void removeAllStreams() {
|
||||
this.streams.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static class NeutronStream {
|
||||
|
||||
public RBMKNode origin;
|
||||
|
||||
// doubles!!
|
||||
public double fluxQuantity;
|
||||
// Hey, new implementation! Basically a ratio for slow flux to fast flux
|
||||
// 0 = all slow flux
|
||||
// 1 = all fast flux
|
||||
public double fluxRatio;
|
||||
|
||||
// Vector for direction of neutron flow.
|
||||
public Vec3 vector;
|
||||
|
||||
// Primarily used as a "dummy stream", not to be added to the streams list.
|
||||
public NeutronStream(RBMKNode origin, Vec3 vector) {
|
||||
this.origin = origin;
|
||||
this.vector = vector;
|
||||
}
|
||||
|
||||
public NeutronStream(RBMKNode origin, Vec3 vector, double flux, double ratio) {
|
||||
this.origin = origin;
|
||||
this.vector = vector;
|
||||
this.fluxQuantity = flux;
|
||||
this.fluxRatio = ratio;
|
||||
World worldObj = origin.tile.getWorldObj();
|
||||
if (streamWorlds.get(worldObj) == null) {
|
||||
StreamWorld world = new StreamWorld();
|
||||
world.addStream(this);
|
||||
streamWorlds.put(worldObj, world);
|
||||
} else
|
||||
streamWorlds.get(worldObj).addStream(this);
|
||||
}
|
||||
|
||||
// USES THE CACHE!!!
|
||||
public List<BlockPos> getBlocks() {
|
||||
List<BlockPos> positions = new ArrayList<>();
|
||||
|
||||
for (int i = 1; i <= fluxRange; i++) {
|
||||
int x = (int) Math.floor(0.5 + vector.xCoord * i);
|
||||
int z = (int) Math.floor(0.5 + vector.zCoord * i);
|
||||
|
||||
BlockPos pos = new BlockPos(origin.tile).add(x, 0, z);
|
||||
positions.add(pos);
|
||||
}
|
||||
return positions;
|
||||
public RBMKNeutronStream(NeutronNode origin, Vec3 vector, double flux, double ratio) {
|
||||
super(origin, vector, flux, ratio, NeutronType.RBMK);
|
||||
}
|
||||
|
||||
// Does NOT include the origin node
|
||||
// USES THE CACHE!!!
|
||||
public List<RBMKNode> getNodes(boolean addNode) {
|
||||
List<RBMKNode> positions = new ArrayList<>();
|
||||
public List<RBMKNeutronNode> getNodes(boolean addNode) {
|
||||
List<RBMKNeutronNode> positions = new ArrayList<>();
|
||||
|
||||
for (int i = 1; i <= fluxRange; i++) {
|
||||
int x = (int) Math.floor(0.5 + vector.xCoord * i);
|
||||
@ -247,17 +179,17 @@ public class RBMKHandler {
|
||||
|
||||
BlockPos pos = new BlockPos(origin.tile).add(x, 0, z);
|
||||
|
||||
if (nodeCache.containsKey(pos))
|
||||
positions.add(getNode(pos));
|
||||
if (NeutronNodeWorld.nodeCache.containsKey(pos))
|
||||
positions.add((RBMKNeutronNode) NeutronNodeWorld.getNode(pos));
|
||||
|
||||
else if (this.origin.tile.getBlockType() instanceof RBMKBase) {
|
||||
TileEntity te = blockPosToTE(this.origin.tile.getWorldObj(), pos);
|
||||
if (te instanceof TileEntityRBMKBase) {
|
||||
TileEntityRBMKBase rbmkBase = (TileEntityRBMKBase)te;
|
||||
RBMKNode node = makeNode(rbmkBase);
|
||||
TileEntityRBMKBase rbmkBase = (TileEntityRBMKBase) te;
|
||||
RBMKNeutronNode node = makeNode(rbmkBase);
|
||||
positions.add(node);
|
||||
if (addNode)
|
||||
addNode(node);
|
||||
NeutronNodeWorld.addNode(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,36 +200,36 @@ public class RBMKHandler {
|
||||
public void runStreamInteraction(World worldObj) {
|
||||
|
||||
// do nothing if there's nothing to do lmao
|
||||
if(fluxQuantity == 0D)
|
||||
if (fluxQuantity == 0D)
|
||||
return;
|
||||
|
||||
BlockPos pos = new BlockPos(origin.tile);
|
||||
|
||||
TileEntityRBMKBase originTE;
|
||||
|
||||
if (nodeCache.containsKey(pos))
|
||||
originTE = nodeCache.get(pos).tile;
|
||||
if (NeutronNodeWorld.nodeCache.containsKey(pos))
|
||||
originTE = (TileEntityRBMKBase) NeutronNodeWorld.nodeCache.get(pos).tile;
|
||||
else {
|
||||
originTE = (TileEntityRBMKBase) blockPosToTE(worldObj, pos);
|
||||
if(originTE == null)
|
||||
if (originTE == null)
|
||||
return; // Doesn't exist anymore!
|
||||
addNode(new RBMKNode(originTE, originTE.getRBMKType()));
|
||||
NeutronNodeWorld.addNode(new RBMKNeutronNode(originTE, originTE.getRBMKType(), originTE.hasLid()));
|
||||
}
|
||||
|
||||
int moderatedCount = 0;
|
||||
|
||||
for(BlockPos nodePos : getBlocks()) {
|
||||
for (BlockPos nodePos : getBlocks(fluxRange)) {
|
||||
|
||||
if(fluxQuantity == 0D) // Whoops, used it all up!
|
||||
if (fluxQuantity == 0D) // Whoops, used it all up!
|
||||
return;
|
||||
|
||||
RBMKNode node = nodeCache.get(nodePos);
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.nodeCache.get(nodePos);
|
||||
|
||||
if(node == null) {
|
||||
if (node == null) {
|
||||
TileEntity te = blockPosToTE(worldObj, nodePos); // ok, maybe it didn't get added to the list somehow??
|
||||
if (te instanceof TileEntityRBMKBase) {
|
||||
node = makeNode((TileEntityRBMKBase) te);
|
||||
addNode(node); // whoops!
|
||||
NeutronNodeWorld.addNode(node); // whoops!
|
||||
} else {
|
||||
int hits = getHits(nodePos); // Get the amount of hits on blocks.
|
||||
if (hits == columnHeight) // If stream is fully blocked.
|
||||
@ -313,42 +245,44 @@ public class RBMKHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(node.type == RBMKType.OTHER) // pass right on by!
|
||||
RBMKType type = (RBMKType) node.data.get("type");
|
||||
|
||||
if (type == RBMKType.OTHER) // pass right on by!
|
||||
continue;
|
||||
|
||||
// we established earlier during `getNodes()` that they should all be RBMKBase TEs
|
||||
// no issue with casting here!
|
||||
TileEntityRBMKBase nodeTE = node.tile;
|
||||
TileEntityRBMKBase nodeTE = (TileEntityRBMKBase) node.tile;
|
||||
|
||||
if(!node.hasLid)
|
||||
if (!(boolean) node.data.get("hasLid"))
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, nodePos.getX(), nodePos.getY(), nodePos.getZ(), (float) (this.fluxQuantity * 0.05F));
|
||||
|
||||
if (node.type == RBMKType.MODERATOR || nodeTE.isModerated()) {
|
||||
if (type == RBMKType.MODERATOR || nodeTE.isModerated()) {
|
||||
moderatedCount++;
|
||||
moderateStream();
|
||||
}
|
||||
|
||||
if (nodeTE instanceof IRBMKFluxReceiver) {
|
||||
IRBMKFluxReceiver column = (IRBMKFluxReceiver)nodeTE;
|
||||
IRBMKFluxReceiver column = (IRBMKFluxReceiver) nodeTE;
|
||||
|
||||
if (node.type == RBMKType.ROD) {
|
||||
TileEntityRBMKRod rod = (TileEntityRBMKRod)column;
|
||||
if (type == RBMKType.ROD) {
|
||||
TileEntityRBMKRod rod = (TileEntityRBMKRod) column;
|
||||
|
||||
if (rod.hasRod) {
|
||||
rod.receiveFlux(this);
|
||||
return;
|
||||
}
|
||||
|
||||
} else if(node.type == RBMKType.OUTGASSER) {
|
||||
} else if (type == RBMKType.OUTGASSER) {
|
||||
TileEntityRBMKOutgasser outgasser = ((TileEntityRBMKOutgasser) column);
|
||||
|
||||
if(outgasser.canProcess()) {
|
||||
if (outgasser.canProcess()) {
|
||||
column.receiveFlux(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (node.type == RBMKType.CONTROL_ROD) {
|
||||
} else if (type == RBMKType.CONTROL_ROD) {
|
||||
TileEntityRBMKControl rod = (TileEntityRBMKControl) nodeTE;
|
||||
|
||||
if (rod.level > 0.0D) {
|
||||
@ -357,41 +291,43 @@ public class RBMKHandler {
|
||||
continue;
|
||||
}
|
||||
return;
|
||||
} else if (node.type == RBMKType.REFLECTOR) {
|
||||
} else if (type == RBMKType.REFLECTOR) {
|
||||
|
||||
if (this.origin.tile.isModerated())
|
||||
if (((TileEntityRBMKBase) this.origin.tile).isModerated())
|
||||
moderatedCount++;
|
||||
|
||||
if (this.fluxRatio > 0 && moderatedCount > 0)
|
||||
for (int i = 0; i < moderatedCount; i++)
|
||||
moderateStream();
|
||||
|
||||
if (RBMKHandler.reflectorEfficiency != 1.0D) {
|
||||
this.fluxQuantity *= RBMKHandler.reflectorEfficiency;
|
||||
if (reflectorEfficiency != 1.0D) {
|
||||
this.fluxQuantity *= reflectorEfficiency;
|
||||
continue;
|
||||
}
|
||||
|
||||
((TileEntityRBMKRod)originTE).receiveFlux(this);
|
||||
((TileEntityRBMKRod) originTE).receiveFlux(this);
|
||||
return;
|
||||
} else if (node.type == RBMKType.ABSORBER) {
|
||||
if (RBMKHandler.absorberEfficiency == 1)
|
||||
} else if (type == RBMKType.ABSORBER) {
|
||||
if (absorberEfficiency == 1)
|
||||
return;
|
||||
|
||||
this.fluxQuantity *= RBMKHandler.absorberEfficiency;
|
||||
this.fluxQuantity *= absorberEfficiency;
|
||||
}
|
||||
}
|
||||
|
||||
List<RBMKNode> nodes = getNodes(true);
|
||||
List<RBMKNeutronNode> nodes = getNodes(true);
|
||||
if (nodes.isEmpty())
|
||||
return;
|
||||
|
||||
RBMKNode lastNode = nodes.get(nodes.size() - 1);
|
||||
RBMKNeutronNode lastNode = nodes.get(nodes.size() - 1);
|
||||
|
||||
if (lastNode.type != RBMKType.REFLECTOR && lastNode.type != RBMKType.ABSORBER && lastNode.type != RBMKType.CONTROL_ROD)
|
||||
RBMKType lastNodeType = (RBMKType) lastNode.data.get("type");
|
||||
|
||||
if (lastNodeType != RBMKType.REFLECTOR && lastNodeType != RBMKType.ABSORBER && lastNodeType != RBMKType.CONTROL_ROD)
|
||||
irradiateFromFlux((new BlockPos(lastNode.tile)).add(this.vector.xCoord, 0.0D, this.vector.zCoord));
|
||||
|
||||
if (lastNode.type == RBMKType.CONTROL_ROD) {
|
||||
TileEntityRBMKControl rod = (TileEntityRBMKControl)lastNode.tile;
|
||||
if (lastNodeType == RBMKType.CONTROL_ROD) {
|
||||
TileEntityRBMKControl rod = (TileEntityRBMKControl) lastNode.tile;
|
||||
if (rod.getMult() > 0.0D) {
|
||||
this.fluxQuantity *= rod.getMult();
|
||||
irradiateFromFlux((new BlockPos(lastNode.tile)).add(this.vector.xCoord, 0.0D, this.vector.zCoord));
|
||||
@ -426,32 +362,7 @@ public class RBMKHandler {
|
||||
public void moderateStream() {
|
||||
fluxRatio *= (1 - moderatorEfficiency);
|
||||
}
|
||||
}
|
||||
|
||||
// List of all stream worlds.
|
||||
public static HashMap<World, StreamWorld> streamWorlds = new HashMap<>();
|
||||
|
||||
public static void removeAllWorlds() {
|
||||
streamWorlds.clear();
|
||||
}
|
||||
|
||||
// HashMap of all RBMK nodes and their positions.
|
||||
protected static HashMap<BlockPos, RBMKNode> nodeCache = new HashMap<>();
|
||||
|
||||
public static void addNode(RBMKNode node) {
|
||||
nodeCache.put(new BlockPos(node.tile), node);
|
||||
}
|
||||
|
||||
public static void removeNode(BlockPos position) {
|
||||
nodeCache.remove(position);
|
||||
}
|
||||
|
||||
public static RBMKNode getNode(BlockPos position) {
|
||||
return nodeCache.get(position);
|
||||
}
|
||||
|
||||
public static void removeAllNodes() {
|
||||
nodeCache.clear();
|
||||
}
|
||||
|
||||
private static int ticks = 0;
|
||||
@ -462,17 +373,17 @@ public class RBMKHandler {
|
||||
// Remove `StreamWorld` objects if they have no streams.
|
||||
{ // aflghdkljghlkbhfjkghgilurbhlkfjghkffdjgn
|
||||
List<World> toRemove = new ArrayList<>();
|
||||
streamWorlds.forEach((world, streamWorld) -> {
|
||||
NeutronNodeWorld.streamWorlds.forEach((world, streamWorld) -> {
|
||||
if (streamWorld.streams.isEmpty())
|
||||
toRemove.add(world);
|
||||
});
|
||||
|
||||
for (World world : toRemove) {
|
||||
streamWorlds.remove(world);
|
||||
NeutronNodeWorld.streamWorlds.remove(world);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<World, StreamWorld> world : streamWorlds.entrySet()) {
|
||||
for (Entry<World, NeutronNodeWorld.StreamWorld> world : NeutronNodeWorld.streamWorlds.entrySet()) {
|
||||
|
||||
// Gamerule caching because this apparently is kinda slow?
|
||||
// meh, good enough
|
||||
@ -487,9 +398,10 @@ public class RBMKHandler {
|
||||
fluxRange = RBMKDials.getFluxRange(world.getKey());
|
||||
|
||||
for (NeutronStream stream : world.getValue().streams) {
|
||||
stream.runStreamInteraction(world.getKey());
|
||||
if (stream.type == NeutronStream.NeutronType.RBMK)
|
||||
stream.runStreamInteraction(world.getKey());
|
||||
}
|
||||
world.getValue().removeAllStreams();
|
||||
world.getValue().removeAllStreamsOfType(NeutronStream.NeutronType.RBMK);
|
||||
}
|
||||
|
||||
// Freshen the node cache every `cacheTime` ticks to prevent huge RAM usage.
|
||||
@ -497,11 +409,13 @@ public class RBMKHandler {
|
||||
if (ticks >= cacheTime) {
|
||||
ticks = 0;
|
||||
List<BlockPos> toRemove = new ArrayList<>();
|
||||
for(RBMKNode cachedNode : nodeCache.values())
|
||||
toRemove.addAll(cachedNode.checkNode());
|
||||
for(NeutronNode cachedNode : NeutronNodeWorld.nodeCache.values()) {
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) cachedNode;
|
||||
toRemove.addAll(node.checkNode());
|
||||
}
|
||||
|
||||
for(BlockPos pos : toRemove)
|
||||
removeNode(pos);
|
||||
NeutronNodeWorld.removeNode(pos);
|
||||
}
|
||||
ticks++;
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
package com.hbm.handler.rbmkmk2;
|
||||
|
||||
import com.hbm.items.machine.ItemRBMKPellet;
|
||||
import com.hbm.items.machine.ItemRBMKRod;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
public class ItemRBMKRodFluxCurve extends ItemRBMKRod {
|
||||
|
||||
/** Double 1: Flux ratio in.
|
||||
* Double 2: Depletion value.
|
||||
* Return double: Output flux ratio.
|
||||
**/
|
||||
BiFunction<Double, Double, Double> ratioCurve;
|
||||
|
||||
/** Double 1: Flux quantity in. <br>
|
||||
* Double 2: Flux ratio in. <br>
|
||||
* Return double: Output flux quantity.
|
||||
**/
|
||||
BiFunction<Double, Double, Double> fluxCurve;
|
||||
|
||||
public ItemRBMKRodFluxCurve(ItemRBMKPellet pellet) {
|
||||
super(pellet);
|
||||
}
|
||||
|
||||
public ItemRBMKRodFluxCurve(String fullName) {
|
||||
super(fullName);
|
||||
}
|
||||
|
||||
public ItemRBMKRodFluxCurve setOutputRatioCurve(Function<Double, Double> func) {
|
||||
this.ratioCurve = (fluxRatioIn, depletion) -> func.apply(fluxRatioIn) * 1.0D;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemRBMKRodFluxCurve setDepletionOutputRatioCurve(BiFunction<Double, Double, Double> func) {
|
||||
this.ratioCurve = func;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemRBMKRodFluxCurve setOutputFluxCurve(BiFunction<Double, Double, Double> func) {
|
||||
this.fluxCurve = func;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double fluxRatioOut(double fluxRatioIn, double depletion) {
|
||||
return MathHelper.clamp_double(ratioCurve.apply(fluxRatioIn, depletion), 0, 1);
|
||||
}
|
||||
|
||||
public double fluxFromRatio(double quantity, double ratio) {
|
||||
return fluxCurve.apply(quantity, ratio);
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ public class HazardRegistry {
|
||||
registerRBMKRod(rbmk_fuel_zfb_pu241, pu239 * rod_rbmk * 0.1F, wst * rod_rbmk * 7.5F);
|
||||
registerRBMKRod(rbmk_fuel_zfb_am_mix, pu241 * rod_rbmk * 0.1F, wst * rod_rbmk * 10F);
|
||||
registerRBMK(rbmk_fuel_drx, bf * rod_rbmk, bf * rod_rbmk * 100F, true, true, 0, 1F/3F);
|
||||
registerRBMKRod(rbmk_fuel_curve, saf * rod_rbmk * np237 * rod_rbmk, wst * rod_rbmk * 35F);
|
||||
//registerRBMKRod(rbmk_fuel_curve, saf * rod_rbmk * np237 * rod_rbmk, wst * rod_rbmk * 35F);
|
||||
|
||||
registerRBMKPellet(rbmk_pellet_ueu, u * billet, wst * billet * 20F);
|
||||
registerRBMKPellet(rbmk_pellet_meu, uf * billet, wst * billet * 21.5F);
|
||||
|
||||
@ -7,7 +7,6 @@ import com.hbm.handler.ToolAbility;
|
||||
import com.hbm.handler.ToolAbility.LuckAbility;
|
||||
import com.hbm.handler.WeaponAbility;
|
||||
import com.hbm.handler.guncfg.*;
|
||||
import com.hbm.handler.rbmkmk2.ItemRBMKRodFluxCurve;
|
||||
import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
@ -1132,7 +1131,7 @@ public class ModItems {
|
||||
public static ItemRBMKRod rbmk_fuel_zfb_am_mix;
|
||||
public static ItemRBMKRod rbmk_fuel_drx;
|
||||
public static ItemRBMKRod rbmk_fuel_test;
|
||||
public static ItemRBMKRodFluxCurve rbmk_fuel_curve;
|
||||
//public static ItemRBMKRod rbmk_fuel_curve;
|
||||
public static ItemRBMKPellet rbmk_pellet_ueu;
|
||||
public static ItemRBMKPellet rbmk_pellet_meu;
|
||||
public static ItemRBMKPellet rbmk_pellet_heu233;
|
||||
@ -3761,15 +3760,18 @@ public class ModItems {
|
||||
.setHeat(1.0D)
|
||||
.setMeltingPoint(100000)
|
||||
.setUnlocalizedName("rbmk_fuel_test").setTextureName(RefStrings.MODID + ":rbmk_fuel_test");
|
||||
rbmk_fuel_curve = (ItemRBMKRodFluxCurve) new ItemRBMKRodFluxCurve("3D curve test")
|
||||
/* Experimental flux curve shit
|
||||
rbmk_fuel_curve = (ItemRBMKRod) new ItemRBMKRod("3D Flux Curve Test")
|
||||
.setFluxCurve(true)
|
||||
.setOutputFluxCurve((fluxQuantity, fluxRatio) -> fluxQuantity * (1 - Math.pow(fluxRatio, 2)))
|
||||
.setDepletionOutputRatioCurve((ratioIn, depletion) -> Math.pow(ratioIn, 2) * depletion)
|
||||
.setYield(1000000D)
|
||||
.setStats(100)
|
||||
.setFunction(EnumBurnFunc.EXPERIMENTAL)
|
||||
.setHeat(1.0D)
|
||||
.setStats(75)
|
||||
.setFunction(EnumBurnFunc.SQUARE_ROOT)
|
||||
.setHeat(1.5D)
|
||||
.setMeltingPoint(100000)
|
||||
.setUnlocalizedName("rbmk_fuel_curve").setTextureName(RefStrings.MODID + ":rbmk_fuel_curve");
|
||||
*/
|
||||
|
||||
watz_pellet = new ItemWatzPellet().setUnlocalizedName("watz_pellet").setTextureName(RefStrings.MODID + ":watz_pellet");
|
||||
watz_pellet_depleted = new ItemWatzPellet().setUnlocalizedName("watz_pellet_depleted").setTextureName(RefStrings.MODID + ":watz_pellet");
|
||||
@ -6613,7 +6615,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(rbmk_fuel_zfb_am_mix, rbmk_fuel_zfb_am_mix.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_fuel_drx, rbmk_fuel_drx.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_fuel_test, rbmk_fuel_test.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_fuel_curve, rbmk_fuel_curve.getUnlocalizedName());
|
||||
//GameRegistry.registerItem(rbmk_fuel_curve, rbmk_fuel_curve.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerItem(rbmk_pellet_ueu, rbmk_pellet_ueu.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_pellet_meu, rbmk_pellet_meu.getUnlocalizedName());
|
||||
|
||||
@ -2,7 +2,8 @@ package com.hbm.items.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
|
||||
|
||||
@ -15,8 +16,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import static com.hbm.handler.rbmkmk2.RBMKHandler.getNode;
|
||||
|
||||
public class ItemRBMKLid extends Item {
|
||||
|
||||
@Override
|
||||
@ -42,7 +41,7 @@ public class ItemRBMKLid extends Item {
|
||||
if(tile.hasLid())
|
||||
return false;
|
||||
|
||||
RBMKHandler.RBMKNode node = getNode(new BlockPos(te));
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(new BlockPos(te));
|
||||
if (node != null)
|
||||
node.addLid();
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.hbm.items.machine;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -14,6 +16,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemRBMKRod extends Item {
|
||||
@ -241,7 +244,7 @@ public class ItemRBMKRod extends Item {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reactivity [0;100] ...or at least those are sane levels
|
||||
* @param enrichment [0;100] ...or at least those are sane levels
|
||||
* @return the amount of reactivity yielded, unmodified by xenon
|
||||
*/
|
||||
public double reactivityFunc(double in, double enrichment) {
|
||||
@ -355,7 +358,55 @@ public class ItemRBMKRod extends Item {
|
||||
public static double getPoisonLevel(ItemStack stack) {
|
||||
return getPoison(stack) / 100D;
|
||||
}
|
||||
|
||||
|
||||
// START Special flux curve handling!
|
||||
// Nothing really uses this yet, though it's a really fun feature to play around with.
|
||||
|
||||
// For the RBMK handler to see if the rod is special.
|
||||
public boolean specialFluxCurve = false;
|
||||
|
||||
public ItemRBMKRod setFluxCurve(boolean bool) {
|
||||
specialFluxCurve = bool;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Double 1: Flux ratio in.
|
||||
* Double 2: Depletion value.
|
||||
* Return double: Output flux ratio.
|
||||
**/
|
||||
BiFunction<Double, Double, Double> ratioCurve;
|
||||
|
||||
/** Double 1: Flux quantity in. <br>
|
||||
* Double 2: Flux ratio in. <br>
|
||||
* Return double: Output flux quantity.
|
||||
**/
|
||||
BiFunction<Double, Double, Double> fluxCurve;
|
||||
|
||||
public ItemRBMKRod setOutputRatioCurve(Function<Double, Double> func) {
|
||||
this.ratioCurve = (fluxRatioIn, depletion) -> func.apply(fluxRatioIn) * 1.0D;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemRBMKRod setDepletionOutputRatioCurve(BiFunction<Double, Double, Double> func) {
|
||||
this.ratioCurve = func;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemRBMKRod setOutputFluxCurve(BiFunction<Double, Double, Double> func) {
|
||||
this.fluxCurve = func;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double fluxRatioOut(double fluxRatioIn, double depletion) {
|
||||
return MathHelper.clamp_double(ratioCurve.apply(fluxRatioIn, depletion), 0, 1);
|
||||
}
|
||||
|
||||
public double fluxFromRatio(double quantity, double ratio) {
|
||||
return fluxCurve.apply(quantity, ratio);
|
||||
}
|
||||
|
||||
// END Special flux curve handling.
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
|
||||
@ -9,7 +9,9 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.PileNeutronHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
@ -537,8 +539,8 @@ public class ModEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onUnload(WorldEvent.Unload event) {
|
||||
RBMKHandler.removeAllWorlds(); // Remove world from worlds when unloaded to avoid world issues.
|
||||
RBMKHandler.removeAllNodes(); // Remove all nodes.
|
||||
NeutronNodeWorld.StreamWorld.removeAllWorlds(); // Remove world from worlds when unloaded to avoid world issues.
|
||||
NeutronNodeWorld.removeAllNodes(); // Remove all nodes.
|
||||
}
|
||||
|
||||
public static boolean didSit = false;
|
||||
@ -1151,7 +1153,9 @@ public class ModEventHandler {
|
||||
TileEntityMachineRadarNT.updateSystem();
|
||||
Nodespace.updateNodespace();
|
||||
// RBMK!!!!
|
||||
RBMKHandler.runAllInteractions();
|
||||
RBMKNeutronHandler.runAllInteractions();
|
||||
// Chicago Pile!!!!
|
||||
PileNeutronHandler.runAllInteractions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.NeutronStream;
|
||||
|
||||
public interface IRBMKFluxReceiver {
|
||||
|
||||
@ -16,5 +16,5 @@ public interface IRBMKFluxReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
public void receiveFlux(RBMKHandler.NeutronStream stream);
|
||||
public void receiveFlux(NeutronStream stream);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
public class TileEntityRBMKAbsorber extends TileEntityRBMKBase {
|
||||
@ -19,8 +19,8 @@ public class TileEntityRBMKAbsorber extends TileEntityRBMKBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.ABSORBER;
|
||||
public RBMKType getRBMKType() {
|
||||
return RBMKType.ABSORBER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.entity.projectile.EntityRBMKDebris;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
@ -41,7 +42,12 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Base class for all RBMK components, active or passive. Handles heat and the explosion sequence
|
||||
@ -243,13 +249,15 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
|
||||
heat = 20D;
|
||||
}
|
||||
|
||||
public abstract RBMKNeutronHandler.RBMKType getRBMKType();
|
||||
|
||||
public RBMKType getRBMKType() {
|
||||
return RBMKType.OTHER;
|
||||
}
|
||||
|
||||
protected static boolean diag = false;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
|
||||
if(!diag) {
|
||||
super.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
public class TileEntityRBMKBlank extends TileEntityRBMKBase {
|
||||
@ -18,11 +17,6 @@ public class TileEntityRBMKBlank extends TileEntityRBMKBase {
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.BLANK;
|
||||
|
||||
@ -8,7 +8,6 @@ import api.hbm.tile.IInfoProviderEC;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerRBMKGeneric;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
@ -224,11 +223,6 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.BOILER;
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -132,8 +132,8 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.CONTROL_ROD;
|
||||
public RBMKType getRBMKType() {
|
||||
return RBMKType.CONTROL_ROD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
@ -17,7 +16,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -118,11 +116,6 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidSt
|
||||
this.lastCooled = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.COOLER;
|
||||
|
||||
@ -4,7 +4,6 @@ import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.inventory.container.ContainerRBMKHeater;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
@ -154,11 +153,6 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
||||
super.onMelt(reduce);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnType getConsoleType() {
|
||||
return ColumnType.HEATEX;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
public class TileEntityRBMKModerator extends TileEntityRBMKBase {
|
||||
@ -19,8 +19,8 @@ public class TileEntityRBMKModerator extends TileEntityRBMKBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.MODERATOR;
|
||||
public RBMKType getRBMKType() {
|
||||
return RBMKType.MODERATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,7 +4,8 @@ import api.hbm.fluid.IFluidStandardSender;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.NeutronStream;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.container.ContainerRBMKOutgasser;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
@ -92,7 +93,7 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveFlux(RBMKHandler.NeutronStream stream) {
|
||||
public void receiveFlux(NeutronStream stream) {
|
||||
|
||||
if(canProcess()) {
|
||||
|
||||
@ -167,8 +168,8 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OUTGASSER;
|
||||
public RBMKNeutronHandler.RBMKType getRBMKType() {
|
||||
return RBMKNeutronHandler.RBMKType.OUTGASSER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
public class TileEntityRBMKReflector extends TileEntityRBMKBase {
|
||||
@ -19,8 +19,8 @@ public class TileEntityRBMKReflector extends TileEntityRBMKBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.REFLECTOR;
|
||||
public RBMKNeutronHandler.RBMKType getRBMKType() {
|
||||
return RBMKNeutronHandler.RBMKType.REFLECTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -5,9 +5,11 @@ import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||
import com.hbm.blocks.machine.rbmk.RBMKRod;
|
||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||
import com.hbm.handler.CompatHandler;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.handler.neutron.NeutronStream;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode;
|
||||
import com.hbm.handler.neutron.NeutronStream;
|
||||
import com.hbm.inventory.container.ContainerRBMKRod;
|
||||
import com.hbm.inventory.gui.GUIRBMKRod;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -90,14 +92,15 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
double fluxRatioOut;
|
||||
double fluxQuantityOut;
|
||||
|
||||
if (rod instanceof ItemRBMKRodFluxCurve) { // Experimental flux ratio curve rods!
|
||||
ItemRBMKRodFluxCurve rodCurve = (ItemRBMKRodFluxCurve) rod;
|
||||
// Experimental flux ratio curve rods!
|
||||
// Again, nothing really uses this so its just idle code at the moment.
|
||||
if (rod.specialFluxCurve) {
|
||||
|
||||
fluxRatioOut = rodCurve.fluxRatioOut(this.fluxRatio, ItemRBMKRod.getEnrichment(slots[0]));
|
||||
fluxRatioOut = rod.fluxRatioOut(this.fluxRatio, ItemRBMKRod.getEnrichment(slots[0]));
|
||||
|
||||
double fluxIn;
|
||||
|
||||
fluxIn = rodCurve.fluxFromRatio(this.fluxQuantity, this.fluxRatio);
|
||||
fluxIn = rod.fluxFromRatio(this.fluxQuantity, this.fluxRatio);
|
||||
|
||||
fluxQuantityOut = rod.burn(worldObj, slots[0], fluxIn);
|
||||
} else {
|
||||
@ -181,15 +184,15 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
|
||||
if (flux == 0) {
|
||||
// simple way to remove the node from the cache when no flux is going into it!
|
||||
removeNode(pos);
|
||||
NeutronNodeWorld.removeNode(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
RBMKHandler.RBMKNode node = getNode(pos);
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(pos);
|
||||
|
||||
if(node == null) {
|
||||
node = RBMKHandler.makeNode(this);
|
||||
addNode(node);
|
||||
node = RBMKNeutronHandler.makeNode(this);
|
||||
NeutronNodeWorld.addNode(node);
|
||||
}
|
||||
|
||||
for(ForgeDirection dir : fluxDirs) {
|
||||
@ -214,7 +217,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
this.fluxRatio = 0;
|
||||
} else {
|
||||
this.fluxQuantity = nbt.getDouble("fluxQuantity");
|
||||
this.fluxRatio = nbt.getDouble("fluxRatio");
|
||||
this.fluxRatio = nbt.getDouble("fluxMod");
|
||||
}
|
||||
this.hasRod = nbt.getBoolean("hasRod");
|
||||
}
|
||||
@ -222,8 +225,17 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setDouble("fluxSlow", this.lastFluxQuantity * (1 - fluxRatio));
|
||||
nbt.setDouble("fluxFast", this.lastFluxQuantity * fluxRatio);
|
||||
nbt.setDouble("fluxQuantity", this.fluxQuantity);
|
||||
nbt.setDouble("fluxMod", this.fluxRatio);
|
||||
nbt.setBoolean("hasRod", this.hasRod);
|
||||
}
|
||||
|
||||
// aaaaaaaa
|
||||
public void writeToNBTDiag(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setDouble("fluxSlow", this.fluxQuantity * (1 - fluxRatio));
|
||||
nbt.setDouble("fluxFast", this.fluxQuantity * fluxRatio);
|
||||
nbt.setBoolean("hasRod", this.hasRod);
|
||||
}
|
||||
|
||||
@ -245,7 +257,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
|
||||
public void getDiagData(NBTTagCompound nbt) {
|
||||
diag = true;
|
||||
this.writeToNBT(nbt);
|
||||
this.writeToNBTDiag(nbt);
|
||||
diag = false;
|
||||
|
||||
if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler.RBMKNode;
|
||||
import com.hbm.handler.neutron.NeutronNodeWorld;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import static com.hbm.handler.rbmkmk2.RBMKHandler.*;
|
||||
import static com.hbm.handler.neutron.RBMKNeutronHandler.*;
|
||||
|
||||
public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod {
|
||||
|
||||
@ -26,15 +27,15 @@ public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod {
|
||||
|
||||
if (flux == 0) {
|
||||
// simple way to remove the node from the cache when no flux is going into it!
|
||||
removeNode(pos);
|
||||
NeutronNodeWorld.removeNode(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
RBMKNode node = getNode(pos);
|
||||
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(pos);
|
||||
|
||||
if(node == null) {
|
||||
node = makeNode(this);
|
||||
addNode(node);
|
||||
NeutronNodeWorld.addNode(node);
|
||||
}
|
||||
|
||||
int count = RBMKDials.getReaSimCount(worldObj);
|
||||
@ -44,7 +45,7 @@ public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod {
|
||||
|
||||
neutronVector.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble()));
|
||||
|
||||
new NeutronStream(makeNode(this), neutronVector, flux, ratio);
|
||||
new RBMKNeutronHandler.RBMKNeutronStream(makeNode(this), neutronVector, flux, ratio);
|
||||
// Create new neutron streams
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.handler.rbmkmk2.RBMKHandler;
|
||||
import com.hbm.handler.neutron.RBMKNeutronHandler;
|
||||
import com.hbm.inventory.container.ContainerRBMKStorage;
|
||||
import com.hbm.inventory.gui.GUIRBMKStorage;
|
||||
import com.hbm.items.machine.ItemRBMKRod;
|
||||
@ -42,8 +42,8 @@ public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public RBMKHandler.RBMKType getRBMKType() {
|
||||
return RBMKHandler.RBMKType.OTHER;
|
||||
public RBMKNeutronHandler.RBMKType getRBMKType() {
|
||||
return RBMKNeutronHandler.RBMKType.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user