mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more RBMK gamerules, fixed RBMK fuels incorrect init, proper heat gen
This commit is contained in:
parent
4a5947cec5
commit
f2f6df24b8
@ -1,13 +1,13 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBoiler;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RBMKBoiler extends RBMKBase {
|
||||
|
||||
@ -16,6 +16,10 @@ public class RBMKBoiler extends RBMKBase {
|
||||
|
||||
if(meta >= this.offset)
|
||||
return new TileEntityRBMKBoiler();
|
||||
|
||||
if(hasExtra(meta))
|
||||
return new TileEntityProxyCombo(false, false, true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -28,4 +32,10 @@ public class RBMKBoiler extends RBMKBase {
|
||||
public int getRenderType(){
|
||||
return this.renderIDControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
this.makeExtra(world, x, y + 3, z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.TileEntityProxyInventory;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKRod;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RBMKRod extends RBMKBase {
|
||||
|
||||
@ -15,6 +17,9 @@ public class RBMKRod extends RBMKBase {
|
||||
if(meta >= this.offset)
|
||||
return new TileEntityRBMKRod();
|
||||
|
||||
if(hasExtra(meta))
|
||||
return new TileEntityProxyInventory();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -27,4 +32,10 @@ public class RBMKRod extends RBMKBase {
|
||||
public int getRenderType(){
|
||||
return this.renderIDRods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
this.makeExtra(world, x, y + 3, z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2534,7 +2534,7 @@ public class ModItems {
|
||||
redstone_depleted = new Item().setUnlocalizedName("redstone_depleted").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":redstone_depleted");
|
||||
powder_power = new ItemCustomLore().setUnlocalizedName("powder_power").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_energy_alt");
|
||||
powder_iodine = new ItemCustomLore().setUnlocalizedName("powder_iodine").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_iodine");
|
||||
powder_thorium = new ItemCustomLore().setUnlocalizedName("powder_thorium").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_thorium");
|
||||
powder_thorium = new ItemHazard().addRadiation(ItemHazard.th232 * ItemHazard.powder).toItem().setUnlocalizedName("powder_thorium").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_thorium");
|
||||
powder_neodymium = new ItemCustomLore().setUnlocalizedName("powder_neodymium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":powder_neodymium");
|
||||
powder_astatine = new ItemCustomLore().setUnlocalizedName("powder_astatine").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_astatine");
|
||||
powder_caesium = new ItemCustomLore().setUnlocalizedName("powder_caesium").setCreativeTab(null).setTextureName(RefStrings.MODID + ":powder_caesium");
|
||||
|
||||
@ -6,12 +6,14 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemHazard;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.rbmk.IRBMKFluxReceiver.NType;
|
||||
import com.hbm.tileentity.machine.rbmk.RBMKDials;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemRBMKRod extends ItemHazard {
|
||||
|
||||
@ -61,7 +63,7 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemRBMKRod setStats(double funcStart) {
|
||||
public ItemRBMKRod setStats(double funcEnd) {
|
||||
return setStats(funcEnd, 0);
|
||||
}
|
||||
|
||||
@ -130,16 +132,17 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
* Heat up the core based on the outFlux, then move some heat to the hull
|
||||
* @param stack
|
||||
*/
|
||||
public void updateHeat(ItemStack stack) {
|
||||
public void updateHeat(World world, ItemStack stack) {
|
||||
|
||||
//TODO: use exponentials so the heat function isn't linear (to allow very spicy core temperatures)
|
||||
double coreHeat = this.getCoreHeat(stack);
|
||||
double hullHeat = this.getHullHeat(stack);
|
||||
|
||||
if(coreHeat > hullHeat) {
|
||||
|
||||
coreHeat -= this.diffusion;
|
||||
hullHeat += this.diffusion;
|
||||
double mid = (coreHeat - hullHeat) / 2D;
|
||||
|
||||
coreHeat -= mid * this.diffusion * RBMKDials.getFuelDiffusionMod(world);
|
||||
hullHeat += mid * this.diffusion * RBMKDials.getFuelDiffusionMod(world);
|
||||
|
||||
this.setCoreHeat(stack, coreHeat);
|
||||
this.setHullHeat(stack, hullHeat);
|
||||
@ -151,14 +154,16 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public double provideHeat(ItemStack stack, double heat) {
|
||||
public double provideHeat(World world, ItemStack stack, double heat) {
|
||||
|
||||
double hullHeat = this.getHullHeat(stack);
|
||||
|
||||
if(hullHeat <= heat)
|
||||
return 0;
|
||||
|
||||
double ret = (hullHeat - heat) / 2; //TODO: replace this with an euler func that employs our old buddy diffusion
|
||||
double ret = (hullHeat - heat) / 2;
|
||||
|
||||
ret *= RBMKDials.getFuelHeatProvision(world);
|
||||
|
||||
hullHeat -= ret;
|
||||
this.setHullHeat(stack, hullHeat);
|
||||
@ -227,7 +232,7 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.xenonGen", EnumChatFormatting.WHITE + "x * " + xGen));
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.xenonBurn", EnumChatFormatting.WHITE + "x² * " + xBurn));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmx.heat", heat + "°C"));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmx.diffusion", diffusion + "°C/t"));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmx.diffusion", diffusion + "¹/²"));
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.skinTemp", ((int)(getHullHeat(stack) * 10D) / 10D) + "m"));
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.coreTemp", ((int)(getCoreHeat(stack) * 10D) / 10D) + "m"));
|
||||
list.add(EnumChatFormatting.DARK_RED + I18nUtil.resolveKey("trait.rbmx.melt", meltingPoint + "m"));
|
||||
@ -246,7 +251,7 @@ public class ItemRBMKRod extends ItemHazard {
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.xenonGen", EnumChatFormatting.WHITE + "x * " + xGen));
|
||||
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.xenonBurn", EnumChatFormatting.WHITE + "x² * " + xBurn));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmk.heat", heat + "°C"));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmk.diffusion", diffusion + "°C/t"));
|
||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmk.diffusion", diffusion + "¹/²"));
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.skinTemp", ((int)(getHullHeat(stack) * 10D) / 10D) + "°C"));
|
||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.coreTemp", ((int)(getCoreHeat(stack) * 10D) / 10D) + "°C"));
|
||||
list.add(EnumChatFormatting.DARK_RED + I18nUtil.resolveKey("trait.rbmk.melt", meltingPoint + "°C"));
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.render.block;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.ObjUtil;
|
||||
@ -10,6 +11,7 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
@ -40,9 +42,11 @@ public class RenderRBMKControl implements ISimpleBlockRenderingHandler {
|
||||
GL11.glTranslated(0, 1, 0);
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_rods, "Lid", iicon, tessellator, 0, true);
|
||||
tessellator.draw();
|
||||
if(block != ModBlocks.rbmk_boiler) {
|
||||
tessellator.startDrawingQuads();
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_rods, "Lid", iicon, tessellator, 0, true);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@ -63,14 +67,11 @@ public class RenderRBMKControl implements ISimpleBlockRenderingHandler {
|
||||
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_rods, "Column", iicon, tessellator, 0, true);
|
||||
|
||||
/*if(world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
if(block == ModBlocks.rbmk_boiler && world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
//tessellator.addTranslation(0, 0.125F, 0);
|
||||
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_rods, "Lid", iicon, tessellator, 0, true);
|
||||
//tessellator.addTranslation(0, -0.125F, 0);
|
||||
}*/
|
||||
|
||||
//if(world.getBlock(x, y + 1, z) == Blocks.air)
|
||||
// ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_element, "Lid", ModBlocks.rbmk_rod.getIcon(0, 0), tessellator, 0, true);
|
||||
}
|
||||
|
||||
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);
|
||||
|
||||
|
||||
@ -1,23 +1,44 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RBMKDials {
|
||||
|
||||
|
||||
public static final String KEY_PASSIVE_COOLING = "dialPassiveCooling";
|
||||
public static final String KEY_COLUMN_HEAT_FLOW = "dialColumnHeatFlow";
|
||||
public static final String KEY_FUEL_DIFFUSION_MOD = "dialDiffusionMod";
|
||||
public static final String KEY_HEAT_PROVISION = "dialHeatProvision";
|
||||
|
||||
public static void createDials(World world) {
|
||||
GameRules rules = world.getGameRules();
|
||||
|
||||
if(!rules.getGameRuleStringValue(KEY_PASSIVE_COOLING).isEmpty())
|
||||
rules.setOrCreateGameRule(KEY_PASSIVE_COOLING, "5.0");
|
||||
|
||||
rules.setOrCreateGameRule(KEY_PASSIVE_COOLING, "5.0");
|
||||
rules.setOrCreateGameRule(KEY_COLUMN_HEAT_FLOW, "0.2");
|
||||
rules.setOrCreateGameRule(KEY_FUEL_DIFFUSION_MOD, "1.0");
|
||||
rules.setOrCreateGameRule(KEY_HEAT_PROVISION, "0.2");
|
||||
}
|
||||
|
||||
public static double getPassiveCooling(World world) {
|
||||
return shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_PASSIVE_COOLING), 5.0D);
|
||||
}
|
||||
|
||||
//[0;1]
|
||||
public static double getColumnHeatFlow(World world) {
|
||||
return MathHelper.clamp_double(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_COLUMN_HEAT_FLOW), 5.0D), 0.0D, 1.0D);
|
||||
}
|
||||
|
||||
//[0;1]
|
||||
public static double getFuelDiffusionMod(World world) {
|
||||
return MathHelper.clamp_double(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_FUEL_DIFFUSION_MOD), 1.0D), 0.0D, 1.0D);
|
||||
}
|
||||
|
||||
//[0;1]
|
||||
public static double getFuelHeatProvision(World world) {
|
||||
return MathHelper.clamp_double(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_HEAT_PROVISION), 0.2D), 0.0D, 1.0D);
|
||||
}
|
||||
|
||||
//why make the double representation accessible in a game rule when you can just force me to add a second pointless parsing operation?
|
||||
public static double shittyWorkaroundParseDouble(String s, double def) {
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
|
||||
}
|
||||
|
||||
int members = rec.size();
|
||||
double stepSize = 0.2D;
|
||||
double stepSize = RBMKDials.getColumnHeatFlow(worldObj);
|
||||
|
||||
if(members > 1) {
|
||||
|
||||
@ -128,9 +128,6 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: add faster passive cooling based on temperature (blackbody radiation has an exponent of 4!)
|
||||
*/
|
||||
private void coolPassively() {
|
||||
|
||||
this.heat -= this.passiveCooling();
|
||||
|
||||
@ -47,11 +47,12 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
|
||||
ItemRBMKRod rod = ((ItemRBMKRod)slots[0].getItem());
|
||||
|
||||
double fluxIn = fluxFromType(rod.nType);
|
||||
//System.out.println(fluxIn + " - " + this.fluxFast + " - " + this.fluxSlow);
|
||||
double fluxOut = rod.burn(slots[0], fluxIn);
|
||||
NType rType = rod.rType;
|
||||
|
||||
rod.updateHeat(slots[0]);
|
||||
this.heat += rod.provideHeat(slots[0], heat);
|
||||
rod.updateHeat(worldObj, slots[0]);
|
||||
this.heat += rod.provideHeat(worldObj, slots[0], heat);
|
||||
|
||||
//for spreading, we want the buffered flux to be 0 because we want to know exactly how much gets reflected back
|
||||
this.fluxFast = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user