wood oil & coal tar creosote

This commit is contained in:
Boblet 2022-12-09 13:08:10 +01:00
parent 0b6d457525
commit 1dea7f7ba3
18 changed files with 77 additions and 300 deletions

View File

@ -1,20 +1,38 @@
package com.hbm.blocks.gas;
import java.util.HashSet;
import java.util.Random;
import com.hbm.interfaces.Untested;
import com.hbm.util.Compat;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockGasFlammable extends BlockGasBase {
public static HashSet<Block> fireSources = new HashSet();
public BlockGasFlammable() {
super(0.8F, 0.8F, 0.2F);
if(fireSources.isEmpty()) {
fireSources.add(Blocks.fire);
fireSources.add(Blocks.lava);
fireSources.add(Blocks.torch);
fireSources.add(Blocks.lit_pumpkin);
if(Compat.isModLoaded(Compat.MOD_TIC)) {
Block stoneTorch = Compat.tryLoadBlock(Compat.MOD_TIC, "decoration.stonetorch");
if(stoneTorch != null) {
fireSources.add(stoneTorch);
}
}
}
}
@Override
@ -54,6 +72,15 @@ public class BlockGasFlammable extends BlockGasBase {
super.updateTick(world, x, y, z, rand);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
/* causes burning entities to set off the gas */
if(!world.isRemote && entity.isBurning()) {
this.combust(world, x, y, z);
}
}
@Untested
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
@ -72,7 +99,7 @@ public class BlockGasFlammable extends BlockGasBase {
}
public boolean isFireSource(Block b) {
return b.getMaterial() == Material.fire || b.getMaterial() == Material.lava || b == Blocks.torch;
return this.fireSources.contains(b);
}
@Override

View File

@ -99,12 +99,6 @@ public class SmeltingRecipes {
GameRegistry.addSmelting(ModItems.powder_tantalium, new ItemStack(ModItems.ingot_tantalium), 1.0F);
GameRegistry.addSmelting(ModItems.powder_niobium, new ItemStack(ModItems.ingot_niobium), 1.0F);
GameRegistry.addSmelting(ModItems.powder_coal, DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), 1.0F);
GameRegistry.addSmelting(ModItems.briquette_lignite, DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), 1.0F);
GameRegistry.addSmelting(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK), DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), 1.0F);
GameRegistry.addSmelting(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL), DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), 1.0F);
GameRegistry.addSmelting(ModItems.combine_scrap, new ItemStack(ModItems.ingot_combine_steel), 1.0F);
GameRegistry.addSmelting(ModItems.tank_waste, new ItemStack(ModItems.tank_waste), 0.0F);
GameRegistry.addSmelting(ModItems.rag_damp, new ItemStack(ModItems.rag), 0.1F);

View File

@ -75,6 +75,7 @@ public class OreDictManager {
public static final String KEY_OIL_TAR = "oiltar";
public static final String KEY_CRACK_TAR = "cracktar";
public static final String KEY_COAL_TAR = "coaltar";
public static final String KEY_WOOD_TAR = "woodtar";
public static final String KEY_UNIVERSAL_TANK = "ntmuniversaltank";
public static final String KEY_HAZARD_TANK = "ntmhazardtank";
@ -265,7 +266,7 @@ public class OreDictManager {
public static final DictFrame ANY_HIGHEXPLOSIVE = new DictFrame("AnyHighexplosive");
public static final DictFrame ANY_COKE = new DictFrame("AnyCoke", "Coke");
public static final DictFrame ANY_CONCRETE = new DictFrame("Concrete"); //no any prefix means that any has to be appended with the any() or anys() getters, registering works with the any (i.e. no shape) setter
public static final DictGroup ANY_TAR = new DictGroup("Tar", KEY_OIL_TAR, KEY_COAL_TAR, KEY_CRACK_TAR);
public static final DictGroup ANY_TAR = new DictGroup("Tar", KEY_OIL_TAR, KEY_COAL_TAR, KEY_CRACK_TAR, KEY_WOOD_TAR);
/** Any special psot-RBMK gating material, namely bismuth and arsenic */
public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid");
@ -430,6 +431,7 @@ public class OreDictManager {
OreDictionary.registerOre(KEY_OIL_TAR, fromOne(oil_tar, EnumTarType.CRUDE));
OreDictionary.registerOre(KEY_CRACK_TAR, fromOne(oil_tar, EnumTarType.CRACK));
OreDictionary.registerOre(KEY_COAL_TAR, fromOne(oil_tar, EnumTarType.COAL));
OreDictionary.registerOre(KEY_WOOD_TAR, fromOne(oil_tar, EnumTarType.WOOD));
OreDictionary.registerOre(KEY_UNIVERSAL_TANK, new ItemStack(fluid_tank_full, 1, OreDictionary.WILDCARD_VALUE));
OreDictionary.registerOre(KEY_HAZARD_TANK, new ItemStack(fluid_tank_lead_full, 1, OreDictionary.WILDCARD_VALUE));
@ -484,6 +486,8 @@ public class OreDictManager {
OreDictionary.registerOre("dye", powder_lapis);
OreDictionary.registerOre("dyeBlack", fromOne(oil_tar, EnumTarType.CRUDE));
OreDictionary.registerOre("dyeBlack", fromOne(oil_tar, EnumTarType.CRACK));
OreDictionary.registerOre("dyeGray", fromOne(oil_tar, EnumTarType.COAL));
OreDictionary.registerOre("dyeBrown", fromOne(oil_tar, EnumTarType.WOOD));
OreDictionary.registerOre("dye", oil_tar);
OreDictionary.registerOre("blockGlass", glass_boron);

View File

@ -49,8 +49,6 @@ public class FluidType {
// v v v this entire system is a pain in the ass to work with. i'd much rather define state transitions and heat values manually.
/** How hot this fluid is. Simple enough. */
public int temperature = ROOM_TEMPERATURE;
/** How much heat energy each mB requires to be heated by 1°C. Total heat energy = heatCap * delta-T. */
public double heatCap = DEFAULT_HEATCAP;
/** How much "stuff" there is in one mB. 1mB of water turns into 100mB of steam, therefore steam has a compression of 0.01. Compression is only used for translating fluids into other fluids, heat calculations should ignore this. */
public double compression = DEFAULT_COMPRESSION;
@ -86,11 +84,6 @@ public class FluidType {
return this;
}
public FluidType setHeatCap(double heatCap) {
this.heatCap = heatCap;
return this;
}
public FluidType setCompression(double compression) {
this.compression = compression;
return this;
@ -196,13 +189,6 @@ public class FluidType {
if(temperature < 0) info.add(EnumChatFormatting.BLUE + "" + temperature + "°C");
if(temperature > 0) info.add(EnumChatFormatting.RED + "" + temperature + "°C");
}
/*if(isAntimatter()) info.add(EnumChatFormatting.DARK_RED + "Antimatter");
if(enumTraits.contains(EnumFluidTrait.CORROSIVE_2)) info.add(EnumChatFormatting.GOLD + "Strongly Corrosive");
else if(enumTraits.contains(EnumFluidTrait.CORROSIVE)) info.add(EnumChatFormatting.YELLOW + "Corrosive");
if(enumTraits.contains(EnumFluidTrait.NO_CONTAINER)) info.add(EnumChatFormatting.RED + "Cannot be stored in any universal tank");
if(enumTraits.contains(EnumFluidTrait.LEAD_CONTAINER)) info.add(EnumChatFormatting.YELLOW + "Requires hazardous material tank to hold");*/
List<String> hidden = new ArrayList();
@ -222,31 +208,8 @@ public class FluidType {
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
}
}
/*info.add("");
info.add(EnumChatFormatting.RED + "[DEBUG]");
for(FluidTrait trait : traits) {
info.add(EnumChatFormatting.RED + "-" + trait.name());
}*/
}
/**
* Metadata for describing how the fluid acts, like being corrosive, not having fluid IDs or being only stored in certain containers.
*/
/*@Deprecated
public static enum EnumFluidTrait {
LIQUID,
GASEOUS,
PETROCHEMICAL,
AMAT,
CORROSIVE,
CORROSIVE_2,
NO_CONTAINER,
LEAD_CONTAINER,
NO_ID;
}*/
public static enum ExtContainer {
CANISTER
}

View File

@ -93,6 +93,8 @@ public class Fluids {
public static FluidType SULFURIC_ACID;
public static FluidType MUG;
public static FluidType MUG_HOT;
public static FluidType WOODOIL;
public static FluidType COALCREOSOTE;
private static final HashMap<Integer, FluidType> idMapping = new HashMap();
private static final HashMap<String, FluidType> nameMapping = new HashMap();
@ -129,7 +131,7 @@ public class Fluids {
HOTSTEAM = new FluidType("HOTSTEAM", 0xE7D6D6, 4, 0, 0, EnumSymbol.NONE).setTemp(300).setCompression(0.1D).addTraits(GASEOUS);
SUPERHOTSTEAM = new FluidType("SUPERHOTSTEAM", 0xE7B7B7, 4, 0, 0, EnumSymbol.NONE).setTemp(450).setCompression(1D).addTraits(GASEOUS);
ULTRAHOTSTEAM = new FluidType("ULTRAHOTSTEAM", 0xE39393, 4, 0, 0, EnumSymbol.NONE).setTemp(600).setCompression(10D).addTraits(GASEOUS);
COOLANT = new FluidType("COOLANT", 0xd8fcff, 1, 0, 0, EnumSymbol.NONE).setHeatCap(0.25D).addTraits(LIQUID);
COOLANT = new FluidType("COOLANT", 0xd8fcff, 1, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
LAVA = new FluidType("LAVA", 0xFF3300, 4, 0, 0, EnumSymbol.NOWATER).setTemp(1200).addTraits(LIQUID);
DEUTERIUM = new FluidType("DEUTERIUM", 0x0000FF, 3, 4, 0, EnumSymbol.NONE).addTraits(new FT_Flammable(5_000), new FT_Combustible(FuelGrade.HIGH, 10_000), GASEOUS);
TRITIUM = new FluidType("TRITIUM", 0x000099, 3, 4, 0, EnumSymbol.RADIATION).addTraits(new FT_Flammable(5_000), new FT_Combustible(FuelGrade.HIGH, 10_000), GASEOUS, new FT_VentRadiation(0.001F));
@ -199,9 +201,11 @@ public class Fluids {
GASOLINE_LEADED = new FluidType("GASOLINE_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(0x2F775A, ExtContainer.CANISTER).addTraits(new FT_Flammable(400_000), new FT_Combustible(FuelGrade.HIGH, 1_500_000), LIQUID);
COALGAS_LEADED = new FluidType("COALGAS_LEADED", 0x445772, 1, 2, 0, EnumSymbol.NONE).addContainers(0x1E155F, ExtContainer.CANISTER).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.MEDIUM, 250_000), LIQUID);
SULFURIC_ACID = new FluidType("SULFURIC_ACID", 0xB0AA64, 3, 0, 2, EnumSymbol.ACID).addTraits(new FT_Corrosive(50), LIQUID);
COOLANT_HOT = new FluidType("COOLANT_HOT", 0x99525E, 1, 0, 0, EnumSymbol.NONE).setTemp(600).setHeatCap(COOLANT.heatCap).addTraits(LIQUID);
MUG = new FluidType("MUG", 0x4B2D28, 0, 0, 0, EnumSymbol.NONE).setHeatCap(1D).addTraits(DELICIOUS, LIQUID);
MUG_HOT = new FluidType(78, "MUG_HOT", 0x6B2A20, 0, 0, 0, EnumSymbol.NONE).setHeatCap(MUG.heatCap).setTemp(500).addTraits(DELICIOUS, LIQUID);
COOLANT_HOT = new FluidType("COOLANT_HOT", 0x99525E, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID);
MUG = new FluidType("MUG", 0x4B2D28, 0, 0, 0, EnumSymbol.NONE).addTraits(DELICIOUS, LIQUID);
MUG_HOT = new FluidType("MUG_HOT", 0x6B2A20, 0, 0, 0, EnumSymbol.NONE).setTemp(500).addTraits(DELICIOUS, LIQUID);
WOODOIL = new FluidType("WOODOIL", 0x847D54, 2, 2, 0, EnumSymbol.NONE).addContainers(0xBF7E4F, ExtContainer.CANISTER).addTraits(LIQUID);
COALCREOSOTE = new FluidType(80, "COALCREOSOTE", 0x51694F, 3, 2, 0, EnumSymbol.NONE).addContainers(0x285A3F, ExtContainer.CANISTER).addTraits(LIQUID);
// ^ ^ ^ ^ ^ ^ ^ ^
@ -391,6 +395,9 @@ public class Fluids {
registerCalculatedFuel(BIOGAS, 250_000D * flammabilityLow /* biofuel with half compression, terrible flammability */, 0, null);
registerCalculatedFuel(BIOFUEL, 500_000D /* slightly below diesel */, 2.5D, FuelGrade.HIGH);
registerCalculatedFuel(WOODOIL, 110_000 /* 20_000 TU per 250mB + a bonus */, 0, null);
registerCalculatedFuel(COALCREOSOTE, 250_000 /* 20_000 TU per 100mB + a bonus */, 0, null);
}
private static void registerCalculatedFuel(FluidType type, double base, double combustMult, FuelGrade grade) {

View File

@ -24,20 +24,21 @@ public class CombinationRecipes {
private static HashMap<Object, Pair<ItemStack, FluidStack>> recipes = new HashMap();
public static void register() {
recipes.put(COAL.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(COAL.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(COAL.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALCREOSOTE, 100)));
recipes.put(COAL.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALCREOSOTE, 100)));
recipes.put(LIGNITE.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(LIGNITE.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(new ComparableStack(ModItems.briquette_lignite), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(LIGNITE.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 50)));
recipes.put(LIGNITE.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 50)));
recipes.put(new ComparableStack(ModItems.briquette_lignite), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 50)));
recipes.put(CINNABAR.crystal(), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.MERCURY, 100)));
recipes.put(KEY_LOG, new Pair(new ItemStack(Items.coal, 1 ,1), new FluidStack(Fluids.HEATINGOIL, 10)));
recipes.put(KEY_LOG, new Pair(new ItemStack(Items.coal, 1 ,1), new FluidStack(Fluids.WOODOIL, 250)));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), null));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), null));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), null));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WOOD), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), null));
}
public static Pair<ItemStack, FluidStack> getOutput(ItemStack stack) {

View File

@ -44,6 +44,8 @@ public class RefineryRecipes {
public static final int lcrack_frac_petro = 30;
public static final int coal_frac_coalgas = 30;
public static final int coal_frac_oil = 70;
public static final int creo_frac_coaloil = 10;
public static final int creo_frac_bitu = 90;
//cracking in percent
public static final int oil_crack_oil = 80;
@ -57,6 +59,8 @@ public class RefineryRecipes {
public static final int diesel_crack_kero = 40;
public static final int diesel_crack_petro = 30;
public static final int kero_crack_petro = 60;
public static final int wood_crack_aroma = 10;
public static final int wood_crack_heat = 40;
private static Map<FluidType, Quintet<FluidStack, FluidStack, FluidStack, FluidStack, ItemStack>> refinery = new HashMap();
private static Map<FluidType, Pair<FluidStack, FluidStack>> fractions = new HashMap();
@ -107,6 +111,7 @@ public class RefineryRecipes {
fractions.put(Fluids.LIGHTOIL, new Pair(new FluidStack(Fluids.DIESEL, light_frac_diesel), new FluidStack(Fluids.KEROSENE, light_frac_kero)));
fractions.put(Fluids.LIGHTOIL_CRACK, new Pair(new FluidStack(Fluids.KEROSENE, lcrack_frac_kero), new FluidStack(Fluids.PETROLEUM, lcrack_frac_petro)));
fractions.put(Fluids.COALOIL, new Pair(new FluidStack(Fluids.COALGAS, coal_frac_coalgas), new FluidStack(Fluids.OIL, coal_frac_oil)));
fractions.put(Fluids.COALCREOSOTE, new Pair(new FluidStack(Fluids.COALOIL, creo_frac_coaloil), new FluidStack(Fluids.BITUMEN, creo_frac_bitu)));
}
public static void registerCracking() {
@ -117,6 +122,7 @@ public class RefineryRecipes {
cracking.put(Fluids.DIESEL, new Pair(new FluidStack(Fluids.KEROSENE, diesel_crack_kero), new FluidStack(Fluids.PETROLEUM, diesel_crack_petro)));
cracking.put(Fluids.DIESEL_CRACK, new Pair(new FluidStack(Fluids.KEROSENE, diesel_crack_kero), new FluidStack(Fluids.PETROLEUM, diesel_crack_petro)));
cracking.put(Fluids.KEROSENE, new Pair(new FluidStack(Fluids.PETROLEUM, kero_crack_petro), new FluidStack(Fluids.NONE, 0)));
cracking.put(Fluids.WOODOIL, new Pair(new FluidStack(Fluids.HEATINGOIL, wood_crack_heat), new FluidStack(Fluids.AROMATICS, wood_crack_aroma)));
}
public static Quintet<FluidStack, FluidStack, FluidStack, FluidStack, ItemStack> getRefinery(FluidType oil) {

View File

@ -46,6 +46,8 @@ public class SolidificationRecipes extends SerializableRecipe {
public static final int SF_BIOGAS = 1750;
public static final int SF_BIOFUEL = 750;
public static final int SF_COALOIL = 200;
public static final int SF_CREOSOTE = 200;
public static final int SF_WOOD = 1000;
//mostly for alternate chemistry, dump into SF if not desired
public static final int SF_AROMA = 1000;
public static final int SF_UNSAT = 1000;
@ -65,11 +67,13 @@ public class SolidificationRecipes extends SerializableRecipe {
registerRecipe(SALIENT, 1280, new ItemStack(ModItems.bio_wafer, 8)); //4 (food val) * 2 (sat mod) * 2 (constant) * 10 (quanta) * 8 (batch size)
registerRecipe(ENDERJUICE, 100, Items.ender_pearl);
registerRecipe(OIL, SF_OIL, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(CRACKOIL, SF_OIL, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK));
registerRecipe(COALOIL, SF_OIL, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL));
registerRecipe(HEAVYOIL, SF_HEAVY, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(BITUMEN, SF_BITUMEN, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(OIL, SF_OIL, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(CRACKOIL, SF_CRACK, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK));
registerRecipe(COALOIL, SF_COALOIL, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL));
registerRecipe(HEAVYOIL, SF_HEAVY, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(BITUMEN, SF_BITUMEN, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(COALCREOSOTE, SF_CREOSOTE, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL));
registerRecipe(WOODOIL, SF_WOOD, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WOOD));
registerRecipe(SMEAR, SF_SMEAR, ModItems.solid_fuel);
registerRecipe(HEATINGOIL, SF_HEATING, ModItems.solid_fuel);
@ -93,8 +97,6 @@ public class SolidificationRecipes extends SerializableRecipe {
registerRecipe(BALEFIRE, 250, ModItems.solid_fuel_bf);
//works flawlessly, but the new values are so high that they literally do not fit into the solidifier. some fuels do need a buff.
registerSFAuto(SMEAR);
registerSFAuto(HEATINGOIL);
registerSFAuto(RECLAIMED);

View File

@ -17,7 +17,8 @@ public class ItemEnums {
public static enum EnumTarType {
CRUDE,
CRACK,
COAL
COAL,
WOOD
}
public static enum EnumLegendaryType {

View File

@ -317,7 +317,6 @@ public class TileMappings {
put(TileEntityRBMKConsole.class, "tileentity_rbmk_console");
put(TileEntityRBMKInlet.class, "tileentity_rbmk_inlet");
put(TileEntityRBMKOutlet.class, "tileentity_rbmk_outlet");
put(TileEntityHeatex.class, "tileentity_rbmk_heatex");
}
private static void putNetwork() {

View File

@ -1,191 +0,0 @@
package com.hbm.tileentity.machine.rbmk;
import java.util.ArrayList;
import java.util.List;
import api.hbm.fluid.IFluidStandardTransceiver;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityLoadedBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityHeatex extends TileEntityLoadedBase implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
public List<IFluidAcceptor> coolantList = new ArrayList();
public List<IFluidAcceptor> waterList = new ArrayList();
public FluidTank coolantIn;
public FluidTank coolantOut;
public FluidTank waterIn;
public FluidTank waterOut;
public double heatBuffer;
public static final double maxHeat = 10_000;
public TileEntityHeatex() {
coolantIn = new FluidTank(Fluids.COOLANT_HOT, 1000, 0);
coolantOut = new FluidTank(Fluids.COOLANT, 1000, 1);
waterIn = new FluidTank(Fluids.WATER, 1000, 2);
waterOut = new FluidTank(Fluids.SUPERHOTSTEAM, 1000, 3);
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(worldObj.getTotalWorldTime() % 20 == 0) {
this.subscribeToAllAround(waterIn.getTankType(), this);
this.subscribeToAllAround(coolantIn.getTankType(), this);
}
/* Cool input */
double heatCap = maxHeat - heatBuffer;
int fillCap = coolantOut.getMaxFill() - coolantOut.getFill();
double deltaT = coolantIn.getTankType().temperature - coolantOut.getTankType().temperature;
double heatPot = coolantIn.getFill() * coolantIn.getTankType().heatCap * deltaT;
double heatEff = Math.min(heatCap, heatPot);
int convertMax = (int) (heatEff / (coolantIn.getTankType().heatCap * deltaT));
int convertEff = Math.min(convertMax, fillCap);
coolantIn.setFill(coolantIn.getFill() - convertEff);
coolantOut.setFill(coolantOut.getFill() + convertEff);
this.heatBuffer += convertEff * coolantIn.getTankType().heatCap * deltaT;
double HEAT_PER_MB_WATER = RBMKDials.getBoilerHeatConsumption(worldObj);
/* Heat water */
int waterCap = waterOut.getMaxFill() - waterOut.getFill();
int maxBoil = (int) Math.min(waterIn.getFill(), heatBuffer / HEAT_PER_MB_WATER);
int boilEff = Math.min(maxBoil, waterCap);
waterIn.setFill(waterIn.getFill() - boilEff);
waterOut.setFill(waterOut.getFill() + boilEff);
this.heatBuffer -= boilEff * HEAT_PER_MB_WATER;
coolantIn.updateTank(this, 15);
coolantOut.updateTank(this, 15);
waterIn.updateTank(this, 15);
waterOut.updateTank(this, 15);
this.fillFluidInit(coolantOut.getTankType());
this.fillFluidInit(waterOut.getTankType());
this.sendFluidToAll(waterOut.getTankType(), this);
this.sendFluidToAll(coolantOut.getTankType(), this);
}
}
public static FluidType getConversion(FluidType type) {
if(type == Fluids.MUG_HOT) return Fluids.MUG;
if(type == Fluids.COOLANT_HOT) return Fluids.COOLANT;
return Fluids.NONE;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.coolantIn.readFromNBT(nbt, "cI");
this.coolantOut.readFromNBT(nbt, "cO");
this.waterIn.readFromNBT(nbt, "wI");
this.waterOut.readFromNBT(nbt, "wO");
this.heatBuffer = nbt.getDouble("heat");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
this.coolantIn.writeToNBT(nbt, "cI");
this.coolantOut.writeToNBT(nbt, "cO");
this.waterIn.writeToNBT(nbt, "wI");
this.waterOut.writeToNBT(nbt, "wO");
nbt.setDouble("heat", this.heatBuffer);
}
@Override
public void setFillForSync(int fill, int index) {
if(index == 0) coolantIn.setFill(fill);
if(index == 1) coolantOut.setFill(fill);
if(index == 2) waterIn.setFill(fill);
if(index == 3) waterOut.setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
if(type == coolantIn.getTankType()) coolantIn.setFill(fill);
if(type == coolantOut.getTankType()) coolantOut.setFill(fill);
if(type == waterIn.getTankType()) waterIn.setFill(fill);
if(type == waterOut.getTankType()) waterOut.setFill(fill);
}
@Override
public void setTypeForSync(FluidType type, int index) {
if(index == 0) coolantIn.setTankType(type);
if(index == 1) coolantOut.setTankType(type);
if(index == 2) waterIn.setTankType(type);
if(index == 3) waterOut.setTankType(type);
}
@Override
public int getFluidFill(FluidType type) {
if(type == coolantIn.getTankType()) return coolantIn.getFill();
if(type == coolantOut.getTankType()) return coolantOut.getFill();
if(type == waterIn.getTankType()) return waterIn.getFill();
if(type == waterOut.getTankType()) return waterOut.getFill();
return 0;
}
@Override
public void fillFluidInit(FluidType type) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
fillFluid(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, this.zCoord + dir.offsetZ, getTact(), type);
}
@Override
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@Override
@Deprecated
public boolean getTact() { return worldObj.getTotalWorldTime() % 2 == 0; }
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
if(type == coolantOut.getTankType()) return this.coolantList;
if(type == waterOut.getTankType()) return this.waterList;
return new ArrayList();
}
@Override
public void clearFluidList(FluidType type) {
if(type == coolantOut.getTankType()) this.coolantList.clear();
if(type == waterOut.getTankType()) this.waterList.clear();
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type == coolantIn.getTankType()) return coolantIn.getMaxFill();
if(type == waterIn.getTankType()) return waterIn.getMaxFill();
return 0;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {waterIn, waterOut, coolantIn, coolantOut};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {waterOut, coolantOut};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {waterIn, coolantIn};
}
}

View File

@ -20,6 +20,7 @@ public class Compat {
public static final String MOD_AR = "advancedrocketry";
public static final String MOD_EF = "etfuturum";
public static final String MOD_REC = "ReactorCraft";
public static final String MOD_TIC = "TConstruct";
public static Item tryLoadItem(String domain, String name) {
return (Item) Item.itemRegistry.getObject(getReg(domain, name));

View File

@ -1,43 +0,0 @@
package com.hbm.util;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
public class HeatUtil {
/**
* Returns the amount of mB (with decimals!) of the supplied fluid that can be saturated with the given amount of heat
* @param toHeat The type of fluid that should be saturated
* @param heat The amount of heat used
* @return The amount of fluid that can be fully heated
*/
public static double getHeatableAmount(FluidType toHeat, double heat) {
return heat / (toHeat.heatCap * toHeat.temperature);
}
/**
* @param fluid
* @param amount
* @return The total heat energy stored in the given fluid (with a delta from the fluid's temp to 0°C)
*/
public static double getHeatEnergy(FluidType fluid, int amount) {
return fluid.heatCap * fluid.temperature * amount;
}
public static double getAmountAtStandardPressure(FluidType type, int pressurizedAmount) {
return pressurizedAmount * type.compression;
}
public static double getAmountPressurized(FluidType type, int depressurizedAmount) {
return depressurizedAmount / type.compression;
}
//brain mush, will do math later
/*public static double boilTo(FluidTank cold, FluidTank hot, double heat) {
int pressurizedFluid = cold.getFill();
int pressurizedSpace = hot.getMaxFill() - hot.getFill();
//how much heat energy our input tank has
double initialHeat = getHeatEnergy(cold.getTankType(), pressurizedFluid);
}*/
}

View File

@ -581,6 +581,7 @@ hbmfluid.biofuel=Biodiesel
hbmfluid.biogas=Biogas
hbmfluid.bitumen=Bitumen
hbmfluid.carbondioxide=Kohlenstoffdioxid
hbmfluid.coalcreosote=Kohleteer-Kreosot
hbmfluid.coalgas=Kohlebenzin
hbmfluid.coalgas_leaded=Bleikohlebenzin
hbmfluid.coaloil=Kohleöl
@ -649,6 +650,7 @@ hbmfluid.wastefluid=Flüssiger Atommüll
hbmfluid.wastegas=Gasförmiger Atommüll
hbmfluid.water=Wasser
hbmfluid.watz=Giftiger Schlamm
hbmfluid.woodoil=Holzöl
hbmfluid.xenon=Xenongas
hbmfluid.xpjuice=Erfahrungssaft
@ -2314,6 +2316,7 @@ item.oil_tar.coal.name=Kohleteer
item.oil_tar.name=Ölteer
item.oil_tar.crude.name=Erdölteer
item.oil_tar.crack.name=Crackölteer
item.oil_tar.wood.name=Holzteer
item.overfuse.name=Singularitätsschraubenzieher
item.oxy_mask.name=Sauerstoffmaske
item.paa_boots.name=PaA-"olle Latschen"

View File

@ -931,6 +931,7 @@ hbmfluid.biofuel=Biofuel
hbmfluid.biogas=Biogas
hbmfluid.bitumen=Bitumen
hbmfluid.carbondioxide=Carbon Dioxide
hbmfluid.coalcreosote=Coal Tar Creosote
hbmfluid.coalgas=Coal Gasoline
hbmfluid.coalgas_leaded=Leaded Coal Gasoline
hbmfluid.coaloil=Coal Oil
@ -999,6 +1000,7 @@ hbmfluid.wastefluid=Liquid Nuclear Waste
hbmfluid.wastegas=Gaseous Nuclear Waste
hbmfluid.water=Water
hbmfluid.watz=Poisonous Mud
hbmfluid.woodoil=Wood Oil
hbmfluid.xenon=Xenon Gas
hbmfluid.xpjuice=Experience Juice
hbmpseudofluid.none=Empty
@ -2749,6 +2751,7 @@ item.oil_detector.noOil=No oil detected.
item.oil_tar.coal.name=Coal Tar
item.oil_tar.crude.name=Oil Tar
item.oil_tar.crack.name=Crack Oil Tar
item.oil_tar.wood.name=Wood Tar
item.overfuse.name=Singularity Screwdriver
item.overfuse.desc=Say what?
item.oxy_mask.name=Oxygen Mask

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B