functional RBMK boiler

This commit is contained in:
Bob 2021-05-03 23:06:09 +02:00
parent 8cc1856a23
commit cf29733200
15 changed files with 133 additions and 13 deletions

View File

@ -68,7 +68,8 @@ public class BlockGrate extends Block {
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return side == ForgeDirection.UP;
int meta = world.getBlockMetadata(x, y, z);
return (side == ForgeDirection.UP && meta == 7) || (side == ForgeDirection.DOWN && meta == 0);
}
@Override

View File

@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.config.BombConfig;
import com.hbm.config.RadiationConfig;
import com.hbm.config.VersatileConfig;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.AuxSavedData;
import net.minecraft.block.Block;

View File

@ -1966,6 +1966,8 @@ public class ModItems {
public static Item scrumpy;
public static Item wild_p;
public static Item fabsols_vodka;
public static Item injector_5htp;
public static Item injector_knife;
public static Item hazmat_helmet;
public static Item hazmat_plate;
@ -2965,6 +2967,8 @@ public class ModItems {
scrumpy = new ItemModRevive(1).setUnlocalizedName("scrumpy").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":scrumpy");
wild_p = new ItemModRevive(3).setUnlocalizedName("wild_p").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":wild_p");
fabsols_vodka = new ItemModRevive(9999).setUnlocalizedName("fabsols_vodka").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":fabsols_vodka");
injector_5htp = new ItemModAuto().setUnlocalizedName("injector_5htp").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":injector_5htp");
injector_knife = new ItemModAuto().setUnlocalizedName("injector_knife").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":injector_knife");
can_empty = new Item().setUnlocalizedName("can_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_empty");
can_smart = new ItemEnergy().setUnlocalizedName("can_smart").setContainerItem(ModItems.can_empty).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_smart");
@ -6718,6 +6722,8 @@ public class ModItems {
GameRegistry.registerItem(scrumpy, scrumpy.getUnlocalizedName());
GameRegistry.registerItem(wild_p, wild_p.getUnlocalizedName());
GameRegistry.registerItem(fabsols_vodka, fabsols_vodka.getUnlocalizedName());
GameRegistry.registerItem(injector_5htp, injector_5htp.getUnlocalizedName());
GameRegistry.registerItem(injector_knife, injector_knife.getUnlocalizedName());
//The Gadget
GameRegistry.registerItem(gadget_explosive, gadget_explosive.getUnlocalizedName());

View File

@ -0,0 +1,33 @@
package com.hbm.items.armor;
import java.util.List;
import com.hbm.handler.ArmorModHandler;
import com.hbm.items.ModItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class ItemModAuto extends ItemArmorMod {
public ItemModAuto() {
super(ArmorModHandler.extra, false, true, false, false);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
if(this == ModItems.injector_5htp) {
list.add(EnumChatFormatting.BLUE + "Imported from Japsterdam.");
}
if(this == ModItems.injector_knife) {
list.add(EnumChatFormatting.RED + "Pain.");
list.add("");
list.add(EnumChatFormatting.RED + "Hurts, doesn't it?");
}
list.add("");
super.addInformation(stack, player, list, bool);
}
}

View File

@ -67,7 +67,7 @@ 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(block == ModBlocks.rbmk_boiler && world.getBlock(x, y + 1, z) == Blocks.air) {
if(block == ModBlocks.rbmk_boiler && world.getBlock(x, y + 1, z) != block) {
//tessellator.addTranslation(0, 0.125F, 0);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_rods, "Lid", iicon, tessellator, 0, true);
//tessellator.addTranslation(0, -0.125F, 0);

View File

@ -58,7 +58,7 @@ public class RenderRBMKReflector implements ISimpleBlockRenderingHandler {
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_reflector, "Column", iicon, tessellator, 0, true);
if(world.getBlock(x, y + 1, z) == Blocks.air)
if(world.getBlock(x, y + 1, z) != block)
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_element, "Lid", iicon, tessellator, 0, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);

View File

@ -59,7 +59,7 @@ public class RenderRBMKRod implements ISimpleBlockRenderingHandler {
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_element, "Column", iicon, tessellator, 0, true);
if(world.getBlock(x, y + 1, z) == Blocks.air)
if(world.getBlock(x, y + 1, z) != block)
ObjUtil.renderPartWithIcon((WavefrontObject) ResourceManager.rbmk_element, "Lid", iicon, tessellator, 0, true);
tessellator.addTranslation(-x - 0.5F, -y, -z - 0.5F);

View File

@ -12,6 +12,7 @@ public class RBMKDials {
public static final String KEY_HEAT_PROVISION = "dialHeatProvision";
public static final String KEY_COLUMN_HEIGHT = "dialColumnHeight";
public static final String KEY_PERMANENT_SCRAP = "dialEnablePermaScrap";
public static final String KEY_BOILER_HEAT_CONSUMPTION = "dialBoilerHeatConsumption";
public static void createDials(World world) {
GameRules rules = world.getGameRules();
@ -22,35 +23,72 @@ public class RBMKDials {
rules.setOrCreateGameRule(KEY_HEAT_PROVISION, "0.2");
rules.setOrCreateGameRule(KEY_COLUMN_HEIGHT, "4");
rules.setOrCreateGameRule(KEY_PERMANENT_SCRAP, "false");
rules.setOrCreateGameRule(KEY_BOILER_HEAT_CONSUMPTION, "0.1");
}
/**
* Returns the amount of heat per tick removed from components passively
* @param world
* @return
*/
public static double getPassiveCooling(World world) {
return shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_PASSIVE_COOLING), 5.0D);
}
//[0;1]
/**
* Returns the percentual step size how quickly neighboring component heat equalizes. 1 is instant, 0.5 is in 50% steps, et cetera.
* @param world
* @return [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]
/**
* Returns a modifier for fuel rod diffusion, i.e. how quickly the core and hull temperatures equalize.
* @param world
* @return >0
*/
public static double getFuelDiffusionMod(World world) {
return MathHelper.clamp_double(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_FUEL_DIFFUSION_MOD), 1.0D), 0.0D, 1.0D);
return Math.max(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_FUEL_DIFFUSION_MOD), 1.0D), 0.0D);
}
//[0;1]
/**
* Returns the percentual step size how quickly the fuel hull heat and the component heat equalizes. 1 is instant, 0.5 is in 50% steps, et cetera.
* @param world
* @return [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);
}
/**
* Simple integer that decides how tall the structure is.
* @param world
* @return [0;15]
*/
public static int getColumnHeight(World world) {
return MathHelper.clamp_int(shittyWorkaroundParseInt(world.getGameRules().getGameRuleStringValue(KEY_COLUMN_HEIGHT), 4), 1, 16) - 1;
}
/**
* Whether or not scrap entities despawn on their own or remain alive until picked up.
* @param world
* @return
*/
public static boolean getPermaScrap(World world) {
return world.getGameRules().getGameRuleBooleanValue(KEY_PERMANENT_SCRAP);
}
/**
* How many heat units are consumed per steam unit (scaled per type) produced.
* @param world
* @return >0
*/
public static double getBoilerHeatConsumption(World world) {
return Math.max(shittyWorkaroundParseDouble(world.getGameRules().getGameRuleStringValue(KEY_BOILER_HEAT_CONSUMPTION), 0.1D), 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) {

View File

@ -132,8 +132,8 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
this.heat -= this.passiveCooling();
if(heat < 0)
heat = 0D;
if(heat < 20)
heat = 20D;
}
@Override

View File

@ -42,15 +42,54 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
if(!worldObj.isRemote) {
feed.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
steam.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
double heatCap = this.getHeatFromSteam(steam.getTankType());
double heatProvided = this.heat - heatCap;
if(heatProvided > 0) {
int waterUsed = (int)Math.floor(heatProvided / RBMKDials.getBoilerHeatConsumption(worldObj));
waterUsed = Math.min(waterUsed, feed.getFill());
feed.setFill(feed.getFill() - waterUsed);
int steamProduced = (int)Math.floor((waterUsed * 100) / getFactorFromSteam(steam.getTankType()));
steam.setFill(steam.getFill() + steamProduced);
if(steam.getFill() > steam.getMaxFill()) {
steam.setFill(steam.getMaxFill());
}
}
fillFluidInit(steam.getTankType());
}
super.updateEntity();
}
public double getHeatFromSteam(FluidType type) {
switch(type) {
case STEAM: return 100D;
case HOTSTEAM: return 300D;
case SUPERHOTSTEAM: return 450D;
case ULTRAHOTSTEAM: return 600D;
default: return 0D;
}
}
public double getFactorFromSteam(FluidType type) {
switch(type) {
case STEAM: return 1D;
case HOTSTEAM: return 10D;
case SUPERHOTSTEAM: return 100D;
case ULTRAHOTSTEAM: return 1000D;
default: return 0D;
}
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord, this.yCoord + 5, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, getTact(), type);
}
@Override

View File

@ -1396,6 +1396,8 @@ item.ingot_uranium_fuel.name=Urankernbrennstoffbarren
item.ingot_verticium.name=Verticiumbarren
item.ingot_weidanium.name=Weidaniumbarren
item.ingot_zirconium.name=Zirkoniumwürfel
item.injector_5htp.name=5-HTP-Autoinjektor
item.injector_knife.name=20cm Klingen-Autoinjektor
item.ink.name=林-Tinte
item.insert_doxium.name=Astolfium-dottierte Doxiumeinlage
item.insert_du.name=DU-Einlage

View File

@ -1396,6 +1396,8 @@ item.ingot_uranium_fuel.name=Ingot of Uranium Fuel
item.ingot_verticium.name=Verticium Ingot
item.ingot_weidanium.name=Weidanium Ingot
item.ingot_zirconium.name=Zirconium Cube
item.injector_5htp.name=5-HTP Autoinjector
item.injector_knife.name=8 Inch Blade Autoinjector
item.ink.name=林 Ink
item.insert_doxium.name=Astolfium-Doped Doxium Insert
item.insert_du.name=DU Insert

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB