Small fixes

This commit is contained in:
BallOfEnergy 2024-10-13 15:50:00 -05:00
parent 94c97bc87a
commit b63ff682fd
4 changed files with 23 additions and 31 deletions

View File

@ -11,6 +11,7 @@ public abstract class NeutronNode {
protected NeutronType type;
protected TileEntity tile;
// like NBT but less fucking CANCER
// Holds things like cached RBMK lid values.
protected Map<String, Object> data = new HashMap<>();
public NeutronNode(TileEntity tile, NeutronType type) {

View File

@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.List;
public class NeutronNodeWorld {
// HashMap of all RBMK nodes and their positions.
// HashMap of all neutron nodes and their positions.
protected static HashMap<BlockPos, NeutronNode> nodeCache = new HashMap<>();
public static void addNode(NeutronNode node) {

View File

@ -143,14 +143,6 @@ public class PileNeutronHandler {
}
}
for (Map.Entry<World, NeutronNodeWorld.StreamWorld> world : NeutronNodeWorld.streamWorlds.entrySet()) {
for (NeutronStream stream : world.getValue().streams) {
stream.runStreamInteraction(world.getKey());
}
world.getValue().removeAllStreams();
}
for (Map.Entry<World, NeutronNodeWorld.StreamWorld> world : NeutronNodeWorld.streamWorlds.entrySet()) {
for (NeutronStream stream : world.getValue().streams) {

View File

@ -22,17 +22,17 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
dissipateHeat();
checkRedstone(react());
transmute();
if(this.heat >= this.maxHeat) {
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 4, true, true);
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.gas_radon_dense);
}
if(worldObj.rand.nextFloat() * 2F <= this.heat / (float)this.maxHeat) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
@ -40,55 +40,54 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
data.setDouble("mY", 0.05);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 1, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5),
new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 20));
MainRegistry.proxy.effectNT(data);
}
if(this.progress >= this.maxProgress) {
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.block_graphite_plutonium, this.getBlockMetadata() & 7, 3);
}
}
}
private void dissipateHeat() {
this.heat -= (this.getBlockMetadata() & 4) == 4 ? heat * 0.065 : heat * 0.05; //remove 5% of the stored heat per tick; 6.5% for windscale
}
private int react() {
int reaction = (int) (this.neutrons * (1D - ((double)this.heat / (double)this.maxHeat) * 0.5D)); //max heat reduces reaction by 50% due to thermal expansion
this.lastNeutrons = this.neutrons;
this.neutrons = 0;
int lastProgress = this.progress;
this.progress += reaction;
if(reaction <= 0)
return lastProgress;
this.heat += reaction;
for(int i = 0; i < 12; i++)
this.castRay((int) Math.max(reaction * 0.25, 1));
return lastProgress;
}
private void checkRedstone(int lastProgress) {
int lastLevel = MathHelper.clamp_int((lastProgress * 16) / maxProgress, 0, 15);
int newLevel = MathHelper.clamp_int((progress * 16) / maxProgress, 0, 15);
if(lastLevel != newLevel)
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, this.getBlockType());
}
private void transmute() {
if((this.getBlockMetadata() & 8) == 8) {
if(this.progress < this.maxProgress - 1000) //Might be subject to change, but 1000 seems like a good number.
this.progress = maxProgress - 1000;
return;
} else if(this.progress >= maxProgress - 1000) {
worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata() | 8, 3);
@ -100,7 +99,7 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
public void receiveNeutrons(int n) {
this.neutrons += n;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
@ -108,7 +107,7 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr
this.progress = nbt.getInteger("progress");
this.neutrons = nbt.getInteger("neutrons");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);