RBMK profiling, fixed moderated rods reflecting, cleaned up RadGen fuels

This commit is contained in:
Boblet 2021-11-05 15:09:03 +01:00
parent ea3862c84e
commit 28e0e9ce19
4 changed files with 55 additions and 47 deletions

View File

@ -1,14 +1,19 @@
package com.hbm.tileentity.machine; package com.hbm.tileentity.machine;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.interfaces.IConsumer; import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource; import com.hbm.interfaces.ISource;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.special.ItemWasteLong;
import com.hbm.items.special.ItemWasteShort;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.Tuple.Triplet;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -202,57 +207,45 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IS
return i >= 12; return i >= 12;
} }
public static final HashMap<ComparableStack, Triplet<Integer, Integer, ItemStack>> fuels = new HashMap();
static {
for(int i = 0; i < ItemWasteShort.WasteClass.values().length; i++) {
fuels.put( new ComparableStack(ModItems.nuclear_waste_short, 1, i), new Triplet<Integer, Integer, ItemStack>(150, 30 * 60 * 20, new ItemStack(ModItems.nuclear_waste_short_depleted, 1, i)));
fuels.put( new ComparableStack(ModItems.nuclear_waste_short_tiny, 1, i), new Triplet<Integer, Integer, ItemStack>(15, 3 * 60 * 20, new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, i)));
}
for(int i = 0; i < ItemWasteLong.WasteClass.values().length; i++) {
fuels.put( new ComparableStack(ModItems.nuclear_waste_long, 1, i), new Triplet<Integer, Integer, ItemStack>(50, 2 * 60 * 60 * 20, new ItemStack(ModItems.nuclear_waste_long_depleted, 1, i)));
fuels.put( new ComparableStack(ModItems.nuclear_waste_long_tiny, 1, i), new Triplet<Integer, Integer, ItemStack>(5, 12 * 60 * 20, new ItemStack(ModItems.nuclear_waste_long_depleted_tiny, 1, i)));
}
fuels.put( new ComparableStack(ModItems.scrap_nuclear), new Triplet<Integer, Integer, ItemStack>(5, 5 * 60 * 20, null));
}
private Triplet<Integer, Integer, ItemStack> grabResult(ItemStack stack) {
return fuels.get(new ComparableStack(stack).makeSingular());
}
private int getPowerFromItem(ItemStack stack) { private int getPowerFromItem(ItemStack stack) {
Item item = stack.getItem(); Triplet<Integer, Integer, ItemStack> result = grabResult(stack);
if(result == null)
if(item == ModItems.nuclear_waste_short) return 0;
return 150; return result.getX();
if(item == ModItems.nuclear_waste_long)
return 50;
if(item == ModItems.nuclear_waste_short_tiny)
return 15;
if(item == ModItems.nuclear_waste_long_tiny)
return 5;
if(item == ModItems.scrap_nuclear)
return 5;
return 0;
} }
private int getDurationFromItem(ItemStack stack) { private int getDurationFromItem(ItemStack stack) {
Item item = stack.getItem(); Triplet<Integer, Integer, ItemStack> result = grabResult(stack);
if(result == null)
if(item == ModItems.nuclear_waste_short) return 0;
return 30 * 60 * 20; return result.getY();
if(item == ModItems.nuclear_waste_long)
return 2 * 60 * 60 * 20;
if(item == ModItems.nuclear_waste_short_tiny)
return 3 * 60 * 20;
if(item == ModItems.nuclear_waste_long_tiny)
return 12 * 60 * 20;
if(item == ModItems.scrap_nuclear)
return 5 * 60 * 20;
return 0;
} }
private ItemStack getOutputFromItem(ItemStack stack) { private ItemStack getOutputFromItem(ItemStack stack) {
Item item = stack.getItem(); Triplet<Integer, Integer, ItemStack> result = grabResult(stack);
if(result == null)
if(item == ModItems.nuclear_waste_short) return null;
return new ItemStack(ModItems.nuclear_waste_short_depleted, 1, stack.getItemDamage()); return result.getZ();
if(item == ModItems.nuclear_waste_long)
return new ItemStack(ModItems.nuclear_waste_long_depleted, 1, stack.getItemDamage());
if(item == ModItems.nuclear_waste_short_tiny)
return new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, stack.getItemDamage());
if(item == ModItems.nuclear_waste_long_tiny)
return new ItemStack(ModItems.nuclear_waste_long_depleted_tiny, 1, stack.getItemDamage());
return null;
} }
@Override @Override

View File

@ -68,7 +68,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
/** /**
* Approx melting point of steel * Approx melting point of steel
* This metric won't be used because fuel tends to melt much earlier than that * Fuels often burn much hotter than this but it won't affect the column too much due to low diffusion
* @return * @return
*/ */
public double maxHeat() { public double maxHeat() {
@ -88,6 +88,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
return true; return true;
} }
//unused
public int trackingRange() { public int trackingRange() {
return 25; return 25;
} }
@ -96,9 +97,17 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
public void updateEntity() { public void updateEntity() {
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
this.worldObj.theProfiler.startSection("rbmkBase_heat_movement");
moveHeat(); moveHeat();
if(RBMKDials.getReasimBoilers(worldObj)) boilWater(); if(RBMKDials.getReasimBoilers(worldObj)) {
this.worldObj.theProfiler.endStartSection("rbmkBase_reasim_boilers");
boilWater();
}
this.worldObj.theProfiler.endStartSection("rbmkBase_rpassive_cooling");
coolPassively(); coolPassively();
this.worldObj.theProfiler.endSection();
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
this.writeToNBT(data); this.writeToNBT(data);

View File

@ -46,7 +46,11 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
if(this.worldObj.getTotalWorldTime() % 10 == 0) { if(this.worldObj.getTotalWorldTime() % 10 == 0) {
this.worldObj.theProfiler.startSection("rbmkConsole_rescan");
rescan(); rescan();
this.worldObj.theProfiler.endSection();
prepareNetworkPack(); prepareNetworkPack();
} }
} }

View File

@ -79,7 +79,9 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
this.fluxFast = 0; this.fluxFast = 0;
this.fluxSlow = 0; this.fluxSlow = 0;
this.worldObj.theProfiler.startSection("rbmkRod_flux_spread");
spreadFlux(rType, fluxOut); spreadFlux(rType, fluxOut);
this.worldObj.theProfiler.endSection();
hasRod = true; hasRod = true;
@ -192,7 +194,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
//return the neutrons back to this with no further action required //return the neutrons back to this with no further action required
if(te instanceof TileEntityRBMKReflector) { if(te instanceof TileEntityRBMKReflector) {
this.receiveFlux(stream, flux); this.receiveFlux(this.isModerated() ? NType.SLOW : stream, flux);
return 0; return 0;
} }