From eff844b6e222b578bc0baadbe84f94912cb819f7 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 21 Dec 2021 17:17:34 +0000 Subject: Add Multiblock Forge Hammer. Add base for Multiblock Molecular Transformer. --- src/main/java/gtPlusPlus/core/lib/CORE.java | 1 + src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index 1ef04aa154..cf5539e572 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -276,6 +276,7 @@ public class CORE { public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc = 600; public static int pollutionPerSecondMultiIndustrialPlatePress_ModeForming = 240; public static int pollutionPerSecondMultiIndustrialPlatePress_ModeBending = 480; + public static int pollutionPerSecondMultiIndustrialForgeHammer = 250; public static int pollutionPerSecondMultiIndustrialSifter = 40; public static int pollutionPerSecondMultiIndustrialThermalCentrifuge = 1000; public static int pollutionPerSecondMultiIndustrialVacuumFreezer = 500; diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 1eb8351d65..15b0d8629c 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -24,6 +24,7 @@ public class LoadedMods { public static boolean Simply_Jetpacks = false; public static boolean RFTools = false; public static boolean Thaumcraft = false; + public static boolean ThaumicBases = false; public static boolean Baubles = false; public static boolean Extra_Utils = false; public static boolean PneumaticCraft = false; @@ -41,6 +42,7 @@ public class LoadedMods { public static boolean MiscUtils = true; //Dummy For MetaData Lookups in MT Wrapper public static boolean ThermalFoundation = false; public static boolean IHL = false; + public static boolean AdvancedSolarPanel = false; public static boolean OpenComputers = false; //OpenComputers public static boolean OpenBlocks = false; public static boolean Computronics = false; //computronics @@ -117,6 +119,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: Tinkers Construct"); totalMods++; } + if (isModLoaded("AdvancedSolarPanel")){ + AdvancedSolarPanel = true; + Logger.INFO("Components enabled for: Advanced Solar Panels"); + totalMods++; + } if (isModLoaded("BuildCraft")){ BuildCraft = true; Logger.INFO("Components enabled for: BuildCraft"); @@ -161,12 +168,17 @@ public class LoadedMods { OpenBlocks = true; Logger.INFO("Components enabled for: OpenBlocks"); totalMods++; - } + } if (isModLoaded("Thaumcraft")){ Thaumcraft = true; Logger.INFO("Components enabled for: Thaumcraft"); totalMods++; } + if (isModLoaded("thaumicbases")){ + ThaumicBases = true; + Logger.INFO("Components enabled for: Thaumic Bases"); + totalMods++; + } if (isModLoaded("BiomesOPlenty")){ BiomesOPlenty = true; Logger.INFO("Components enabled for: BiomesOPlenty"); -- cgit From 580024a4f982602974bfbeb639067e93ec41d2fa Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 6 Jan 2022 14:22:19 +0000 Subject: Finished work on multiblock Molecular Transformer. Added single use API for adding MT recipes. --- .../api/helpers/GregtechPlusPlus_API.java | 10 + src/main/java/gtPlusPlus/core/block/ModBlocks.java | 1 + .../java/gtPlusPlus/core/config/ConfigHandler.java | 1 + src/main/java/gtPlusPlus/core/lib/CORE.java | 1 + .../nei/GT_NEI_MolecularTransformer.java | 2 +- .../xmod/gregtech/api/enums/GregtechItemList.java | 4 +- .../blocks/GregtechMetaSpecialMultiCasings.java | 15 +- .../blocks/GregtechMetaSpecialMultiCasings2.java | 99 ++++++++ .../common/blocks/textures/TexturesGtBlock.java | 10 + ...aTileEntity_IndustrialMolecularTransformer.java | 275 +++++++++------------ .../xmod/gregtech/loaders/Gregtech_Blocks.java | 1 + .../miscutils/textures/blocks/special/block_1.png | Bin 0 -> 532 bytes .../miscutils/textures/blocks/special/block_2.png | Bin 0 -> 552 bytes .../miscutils/textures/blocks/special/block_3.png | Bin 0 -> 535 bytes .../miscutils/textures/blocks/special/block_4.png | Bin 0 -> 545 bytes .../miscutils/textures/blocks/special/block_5.png | Bin 0 -> 722 bytes .../miscutils/textures/blocks/special/block_6.png | Bin 0 -> 725 bytes .../miscutils/textures/blocks/special/block_7.png | Bin 0 -> 716 bytes .../miscutils/textures/blocks/special/block_8.png | Bin 0 -> 730 bytes 19 files changed, 257 insertions(+), 162 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_1.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_2.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_3.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_4.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_5.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_6.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_7.png create mode 100644 src/main/resources/assets/miscutils/textures/blocks/special/block_8.png (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java index 6fe4209efe..5cf323c7e2 100644 --- a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java +++ b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java @@ -5,6 +5,7 @@ import java.util.HashMap; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.WeightedCollection; import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy_RTG; import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; @@ -12,6 +13,15 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; public class GregtechPlusPlus_API { + + + public static class MolecularTransformer_API { + + public static boolean addRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU) { + return CORE.RA.addMolecularTransformerRecipe(aInput, aOutput, aDuration, aEU, 1); + } + + } public static class Multiblock_API { diff --git a/src/main/java/gtPlusPlus/core/block/ModBlocks.java b/src/main/java/gtPlusPlus/core/block/ModBlocks.java index b51915bb7b..fdbb2bdf5b 100644 --- a/src/main/java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/main/java/gtPlusPlus/core/block/ModBlocks.java @@ -50,6 +50,7 @@ public final class ModBlocks { public static Block blockCasings5Misc; public static Block blockCasingsTieredGTPP; public static Block blockSpecialMultiCasings; + public static Block blockSpecialMultiCasings2; public static Block blockCustomMachineCasings; public static Block blockMetaTileEntity; diff --git a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java index 94193e8dab..0e88a20aac 100644 --- a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java @@ -229,6 +229,7 @@ public class ConfigHandler { pollutionPerSecondMultiTreeFarm = config.get("pollution", "pollutionPerSecondMultiTreeFarm", pollutionPerSecondMultiTreeFarm,"pollution rate in gibbl/s for the Tree growth simulator").getInt(pollutionPerSecondMultiTreeFarm); pollutionPerSecondMultiFrothFlotationCell = config.get("pollution", "pollutionPerSecondMultiFrothFlotationCell", pollutionPerSecondMultiFrothFlotationCell,"pollution rate in gibbl/s for the Flotation cell regulator").getInt(pollutionPerSecondMultiFrothFlotationCell); pollutionPerSecondMultiAutoCrafter = config.get("pollution", "pollutionPerSecondMultiAutoCrafter", pollutionPerSecondMultiAutoCrafter,"pollution rate in gibbl/s for the Large-Scale auto assembler v1.01").getInt(pollutionPerSecondMultiAutoCrafter); + pollutionPerSecondMultiMolecularTransformer = config.get("pollution", "pollutionPerSecondMultiMolecularTransformer", pollutionPerSecondMultiMolecularTransformer,"pollution rate in gibbl/s for the Multiblock Molecular Transformer").getInt(pollutionPerSecondMultiMolecularTransformer); pollutionPerSecondMultiThermalBoiler = config.get("pollution", "pollutionPerSecondMultiThermalBoiler", pollutionPerSecondMultiThermalBoiler,"pollution rate in gibbl/s for the Thermal boiler").getInt(pollutionPerSecondMultiThermalBoiler); pollutionPerSecondMultiAlgaePond = config.get("pollution", "pollutionPerSecondMultiAlgaePond", pollutionPerSecondMultiAlgaePond,"pollution rate in gibbl/s for the Algae farm").getInt(pollutionPerSecondMultiAlgaePond); basePollutionPerSecondSemiFluidGenerator = config.get("pollution", "basePollutionPerSecondSemiFluidGenerator", basePollutionPerSecondSemiFluidGenerator, "base pollution rate in gibbl/s for the single block semi fluid generators").getInt(basePollutionPerSecondSemiFluidGenerator); diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index cf5539e572..d805375e2d 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -300,6 +300,7 @@ public class CORE { public static int pollutionPerSecondMultiFrothFlotationCell = 0; public static int pollutionPerSecondMultiAutoCrafter = 500; public static int pollutionPerSecondMultiThermalBoiler = 700; + public static int pollutionPerSecondMultiMolecularTransformer = 1000; public static int pollutionPerSecondMultiAlgaePond = 0; //pollution single blocks public static int basePollutionPerSecondSemiFluidGenerator = 40; diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java index 33672b8a76..fc2c16b423 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java @@ -28,7 +28,7 @@ public class GT_NEI_MolecularTransformer extends GTPP_NEI_DefaultHandler { drawText(10, 103, "Amperage: " + aRecipe.mSpecialValue, -16777216); } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20 / aRecipe.mSpecialValue))) + " secs", -16777216); + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index fd5d1fcff2..c5c4de002d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -414,7 +414,9 @@ public enum GregtechItemList implements GregtechItemContainer { // Molecular Transformer Controller_MolecularTransformer, - Casing_MolecularTransformer, + Casing_Molecular_Transformer_1, + Casing_Molecular_Transformer_2, + Casing_Molecular_Transformer_3, // Big Steam Macerator Controller_SteamMaceratorMulti, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java index 0eccd75b66..38d8b38f88 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java @@ -52,9 +52,9 @@ public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbs GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Flotation Cell Casings"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Reinforced Engine Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Molecular Containment Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "High Voltage Current Capacitor"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Particle Containment Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused @@ -69,6 +69,9 @@ public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbs GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8)); GregtechItemList.Casing_Flotation_Cell.set(new ItemStack(this, 1, 9)); GregtechItemList.Casing_Reinforced_Engine_Casing.set(new ItemStack(this, 1, 10)); + GregtechItemList.Casing_Molecular_Transformer_1.set(new ItemStack(this, 1, 11)); + GregtechItemList.Casing_Molecular_Transformer_2.set(new ItemStack(this, 1, 12)); + GregtechItemList.Casing_Molecular_Transformer_3.set(new ItemStack(this, 1, 13)); } @Override @@ -105,6 +108,12 @@ public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbs return TexturesGtBlock.TEXTURE_CASING_FLOTATION.getIcon(); case 10: return TexturesGtBlock.Casing_Material_Talonite.getIcon(); + case 11: + return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); + case 12: + return TexturesGtBlock.Casing_Redox_5.getIcon(); + case 13: + return TexturesGtBlock.TEXTURE_MAGIC_PANEL_A.getIcon(); } return Textures.BlockIcons.RENDERING_ERROR.getIcon(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java new file mode 100644 index 0000000000..7ec655dca5 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java @@ -0,0 +1,99 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Material_Casings; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + + +public class GregtechMetaSpecialMultiCasings2 extends GregtechMetaCasingBlocksAbstract { + + public static class SpecialCasingItemBlock extends GregtechMetaCasingItems { + + public SpecialCasingItemBlock(Block par1) { + super(par1); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + int aMeta = aStack.getItemDamage(); + if (aMeta < 4) { + aList.add("Provides quantum stability"); + } + if (aMeta >= 4 && aMeta < 8) { + aList.add("Provides quantum modulation"); + } + super.addInformation(aStack, aPlayer, aList, aF3_H); + } + } + + public GregtechMetaSpecialMultiCasings2() { + super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.3", GT_Material_Casings.INSTANCE); + for (byte i = 0; i < 16; i = (byte) (i + 1)) { + //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08) + } + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Resonance Chamber I"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Resonance Chamber II"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Resonance Chamber III"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Resonance Chamber IV"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Modulator I"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Modulator II"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Modulator III"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Modulator IV"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused + + //GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 0)); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) { + return getStaticIcon((byte) aSide, (byte) aWorld.getBlockMetadata(xCoord, yCoord, zCoord)); + } + + @Override + public IIcon getIcon(final int aSide, final int aMeta) { + return getStaticIcon((byte) aSide, (byte) aMeta); + } + + public static IIcon getStaticIcon(final byte aSide, final byte aMeta) { + switch (aMeta) { + case 0: + return TexturesGtBlock.Casing_Resonance_1.getIcon(); + case 1: + return TexturesGtBlock.Casing_Resonance_2.getIcon(); + case 2: + return TexturesGtBlock.Casing_Resonance_3.getIcon(); + case 3: + return TexturesGtBlock.Casing_Resonance_4.getIcon(); + case 4: + return TexturesGtBlock.Casing_Modulator_1.getIcon(); + case 5: + return TexturesGtBlock.Casing_Modulator_2.getIcon(); + case 6: + return TexturesGtBlock.Casing_Modulator_3.getIcon(); + case 7: + return TexturesGtBlock.Casing_Modulator_4.getIcon(); + + } + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 59e4f2e4b3..246f016202 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -247,6 +247,16 @@ public class TexturesGtBlock { public static final CustomIcon Casing_Redox_6 = new CustomIcon("redox/redox6"); //public static final CustomIcon Casing_Redox_7 = new CustomIcon("redox/redox7"); //public static final CustomIcon Casing_Redox_8 = new CustomIcon("redox/redox8"); + + // Special Block 2 + public static final CustomIcon Casing_Resonance_1 = new CustomIcon("special/block_1"); + public static final CustomIcon Casing_Resonance_2 = new CustomIcon("special/block_2"); + public static final CustomIcon Casing_Resonance_3 = new CustomIcon("special/block_3"); + public static final CustomIcon Casing_Resonance_4 = new CustomIcon("special/block_4"); + public static final CustomIcon Casing_Modulator_1 = new CustomIcon("special/block_5"); + public static final CustomIcon Casing_Modulator_2 = new CustomIcon("special/block_6"); + public static final CustomIcon Casing_Modulator_3 = new CustomIcon("special/block_7"); + public static final CustomIcon Casing_Modulator_4 = new CustomIcon("special/block_8"); //Centrifuge Casing private static final CustomIcon Internal_Casing_Centrifuge = new CustomIcon("TileEntities/MACHINE_CASING_CENTRIFUGE"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java index b8e8a904b7..edbf0813ae 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java @@ -1,21 +1,21 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import gregtech.api.enums.TAE; +import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; @@ -32,24 +32,20 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends GregtechMeta_MultiBlockBase { - public static int CASING_TEXTURE_ID; - private int mCasing; - private IStructureDefinition STRUCTURE_DEFINITION = null; - + private static final int CASING_TEXTURE_ID = 48; + private int mCasing = 0; public GregtechMetaTileEntity_IndustrialMolecularTransformer(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10); } public GregtechMetaTileEntity_IndustrialMolecularTransformer(final String aName) { super(aName); - CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10); } public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { @@ -66,95 +62,149 @@ public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends Gregt GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType(getMachineType()) - .addInfo("Factory Grade Advanced Vacuum Freezer") - .addInfo("Speed: 200% | Eu Usage: 100% | Parallel: 4") + .addInfo("Changes the structure of items to produce new ones") + .addInfo("Speed: 100% | Eu Usage: 100%") + .addInfo("This multiblock cannot be overclocked") + .addInfo("Maximum 1x of each bus/hatch.") .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front Center") - .addCasingInfo("CASING", 10) - .addInputBus("Any Casing", 1) - .addOutputBus("Any Casing", 1) - .addInputHatch("Any Casing", 1) - .addOutputHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .addMaintenanceHatch("Any Casing", 1) - .addMufflerHatch("Any Casing", 1) + .beginStructureBlock(7, 7, 7, false) + .addController("Top Center") + .addCasingInfo("Robust Tungstensteel Machine Casing", 40) + .addCasingInfo("Tungstensteel Coils", 16) + .addCasingInfo("Molecular Containment Casing", 52) + .addCasingInfo("High Voltage Current Capacitor", 32) + .addCasingInfo("Particle Containment Casing", 4) + .addCasingInfo("Resonance Chamber I", 5) + .addCasingInfo("Modulator I", 4) + .addInputBus("Any Robust Tungstensteel Machine Casing", 1) + .addOutputBus("Any Robust Tungstensteel Machine Casing", 1) + .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1) + .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1) + .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1) .toolTipFinisher(CORE.GT_Tooltip_Builder); return tt; } + + private static final String STRUCTURE_PIECE_MAIN = "main"; + private IStructureDefinition STRUCTURE_DEFINITION = null; + @Override public IStructureDefinition getStructureDefinition() { + STRUCTURE_DEFINITION = null; if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.builder() - .addShape(mName, transpose(new String[][]{ - {"CCC", "CCC", "CCC"}, - {"C~C", "C-C", "CCC"}, - {"CCC", "CCC", "CCC"}, - })) - .addElement( - 'C', - ofChain( - ofHatchAdder( - GregtechMetaTileEntity_IndustrialMolecularTransformer::addIndustrialVacuumFreezerList, CASING_TEXTURE_ID, 1 - ), - onElementPass( - x -> ++x.mCasing, - ofBlock( - ModBlocks.blockCasings3Misc, 10 - ) - ) - ) - ) - .build(); + .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{ + {" ", " ", " xxx ", " x~x ", " xxx ", " ", " "}, + {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "}, + {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "}, + {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "}, + {" t ", " ttxtt ", " tyyyt ", "txyzyxt", " tyyyt ", " ttxtt ", " t "}, + {" c ", " ccecc ", " cxfxc ", "cefefec", " cxfxc ", " ccecc ", " c "}, + {" h ", " hhhhh ", " hhhhh ", "hhhhhhh", " hhhhh ", " hhhhh ", " h "}, + })) + + .addElement('x', ofBlock(getCasingBlock(), getCasingMeta())) + .addElement('y', ofBlock(getCasingBlock(), getCasingMeta2())) + .addElement('z', ofBlock(getCasingBlock(), getCasingMeta3())) + .addElement('e', ofBlock(getCasingBlock2(), 0)) + .addElement('f', ofBlock(getCasingBlock2(), 4)) + .addElement('c', ofBlock(getCoilBlock(), 3)) + .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta())))) + .addElement('h', lazy(t -> ofChain( + ofHatchAdder(GregtechMetaTileEntity_IndustrialMolecularTransformer::addGenericHatch, getCasingTextureIndex(), 1), + onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta())) + ))) + .build(); } return STRUCTURE_DEFINITION; } - + @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(mName , stackSize, hintsOnly, 1, 1, 0); + buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 3, 3, 0); } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; - return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); + boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); + if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) { + return false; + } + return aDidBuild && mCasing >= 40 && checkHatch(); + } + + protected static int getCasingTextureIndex() { + return CASING_TEXTURE_ID; } - public final boolean addIndustrialVacuumFreezerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + protected static Block getCasingBlock() { + return ModBlocks.blockSpecialMultiCasings; + } + + protected static Block getCasingBlock2() { + return ModBlocks.blockSpecialMultiCasings2; + } + + protected static Block getCasingBlock3() { + return GregTech_API.sBlockCasings4; + } + + protected static Block getCoilBlock() { + return GregTech_API.sBlockCasings5; + } + + protected static int getCasingMeta() { + return 11; + } + + protected static int getCasingMeta2() { + return 12; + } + + protected static int getCasingMeta3() { + return 13; + } + + protected static int getTungstenCasingMeta() { + return 0; + } + + public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; - } else { + } + else { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){ - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){ - return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { return addToMachineList(aTileEntity, aBaseCasingIndex); } } + log("Bad Hatch"); return false; } - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44), new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))}; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44)}; } @Override @@ -182,65 +232,7 @@ public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends Gregt @Override public boolean checkRecipe(final ItemStack aStack) { - return this.checkRecipeGeneric(4, 100, 100); - } - - @Override - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) { - // Based on the Processing Array. A bit overkill, but very flexible. - - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; - - ItemStack[] tInputs = getCompactedInputs(); - FluidStack[] tFluids = new FluidStack[] {}; - - if (tInputs.length <= 0) { - log("Error 1"); - return false; - } - - long tVoltage = getMaxInputVoltage(); - log("Voltage: "+tVoltage); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - log("Tier: "+tTier); - GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - - if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - log("Error 2"); - return false; - } - - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - calculateOverclockedNessMulti(tRecipe.mEUt*tRecipe.mSpecialValue, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) { - log("Error 3"); - return false; - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - log("EU/t: "+this.mEUt); - this.mMaxProgresstime = Math.max(mMaxProgresstime/tRecipe.mSpecialValue, 1); - log("Total Time: "+this.mMaxProgresstime); - if (tRecipe.mOutputs.length > 0) { - this.mOutputItems = tRecipe.mOutputs.clone(); - } - updateSlots(); - // Play sounds (GT++ addition - GT multiblocks play no sounds) - startProcess(); - - log("Running"); - return true; + return checkRecipeGeneric(1, 100, 100); } @Override @@ -258,7 +250,7 @@ public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends Gregt } public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialVacuumFreezer; + return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer; } public int getDamageToComponent(final ItemStack aStack) { @@ -270,43 +262,12 @@ public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends Gregt } @Override - public boolean drainEnergyInput(long aEU) { - if (aEU <= 0) { - return true; - } - for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - @Override - public long getMaxInputVoltage() { - long rVoltage = 0; - for (GT_MetaTileEntity_Hatch tHatch : mAllEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); - } - } - return rVoltage; - } - - /** - * Called every tick the Machine runs - */ - @Override - public boolean onRunningTick(ItemStack aStack) { - if (mEUt < 0) { - if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { - criticalStopMachine(); - return false; - } - } - return true; - } + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + // Fix GT bug + if (this.getBaseMetaTileEntity().getFrontFacing() != 1) { + this.getBaseMetaTileEntity().setFrontFacing((byte) 1); + } + } } \ No newline at end of file diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index e918d8015e..d2fb97010a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -16,6 +16,7 @@ public class Gregtech_Blocks { ModBlocks.blockCasingsTieredGTPP = new GregtechMetaTieredCasingBlocks1(); ModBlocks.blockSpecialMultiCasings = new GregtechMetaSpecialMultiCasings(); + ModBlocks.blockSpecialMultiCasings2 = new GregtechMetaSpecialMultiCasings2(); ModBlocks.blockCustomMachineCasings = new GregtechMetaSpecialMachineCasings(); } diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_1.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_1.png new file mode 100644 index 0000000000..2d497c1f81 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_1.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_2.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_2.png new file mode 100644 index 0000000000..efec483a20 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_2.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_3.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_3.png new file mode 100644 index 0000000000..c6376014e2 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_3.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_4.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_4.png new file mode 100644 index 0000000000..55c42584ba Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_4.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_5.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_5.png new file mode 100644 index 0000000000..6b2c6a77b1 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_5.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_6.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_6.png new file mode 100644 index 0000000000..446478f1de Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_6.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_7.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_7.png new file mode 100644 index 0000000000..a8f51c0b68 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_7.png differ diff --git a/src/main/resources/assets/miscutils/textures/blocks/special/block_8.png b/src/main/resources/assets/miscutils/textures/blocks/special/block_8.png new file mode 100644 index 0000000000..08afad396a Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/special/block_8.png differ -- cgit From 13b79706b6eddef6118453bf51782ad01b3e8328 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 9 Jan 2022 17:49:52 +0000 Subject: Partially implemented Computer Cube. Fix Multis wanting Mufflers when pollution = 0. Fix getMethodName potentially crawling too far up the stack. --- src/main/java/gtPlusPlus/core/lib/CORE.java | 49 +- .../core/util/reflect/ReflectionUtils.java | 3 + .../java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 2 + .../xmod/gregtech/api/enums/GregtechItemList.java | 1 + .../gui/computer/GT_Container_ComputerCube.java | 314 +++++++ .../gui/computer/GT_GUIContainer_ComputerCube.java | 133 +++ .../base/GregtechMeta_MultiBlockBase.java | 2 +- .../common/blocks/textures/TexturesGtBlock.java | 1 + .../computer/GT_ComputercubeDescription.java | 189 ++++ .../misc/GT_TileEntity_ComputerCube.java | 986 +++++++++++++++++++++ .../registration/gregtech/Gregtech4Content.java | 9 + .../textures/blocks/TileEntities/gt4/computer.png | Bin 0 -> 822 bytes .../assets/miscutils/textures/gui/computer/0.png | Bin 0 -> 3702 bytes .../assets/miscutils/textures/gui/computer/1.png | Bin 0 -> 4237 bytes .../assets/miscutils/textures/gui/computer/2.png | Bin 0 -> 3481 bytes .../assets/miscutils/textures/gui/computer/3.png | Bin 0 -> 4278 bytes .../assets/miscutils/textures/gui/computer/4.png | Bin 0 -> 4307 bytes .../assets/miscutils/textures/gui/computer/5.png | Bin 0 -> 4072 bytes .../assets/miscutils/textures/gui/computer/6.png | Bin 0 -> 4294 bytes .../miscutils/textures/gui/computer/Redstone.png | Bin 0 -> 2877 bytes 20 files changed, 1666 insertions(+), 23 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java create mode 100644 src/main/resources/assets/miscutils/textures/blocks/TileEntities/gt4/computer.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/0.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/1.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/2.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/3.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/4.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/5.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/6.png create mode 100644 src/main/resources/assets/miscutils/textures/gui/computer/Redstone.png (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index d805375e2d..bb0df9d5fb 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -333,28 +333,33 @@ public class CORE { } public static final void crash(String aReason) { - Logger.INFO("=========================================================="); - Logger.INFO("[GT++ CRASH]"); - Logger.INFO("=========================================================="); - Logger.INFO("Oooops..."); - Logger.INFO("This should only happy in a development environment or when something really bad happens."); - Logger.INFO("Reason: "+aReason); - Logger.INFO("=========================================================="); - Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1)); - Logger.INFO(ReflectionUtils.getMethodName(2)); - Logger.INFO(ReflectionUtils.getMethodName(3)); - Logger.INFO(ReflectionUtils.getMethodName(4)); - Logger.INFO(ReflectionUtils.getMethodName(5)); - Logger.INFO(ReflectionUtils.getMethodName(6)); - Logger.INFO(ReflectionUtils.getMethodName(7)); - Logger.INFO(ReflectionUtils.getMethodName(8)); - Logger.INFO(ReflectionUtils.getMethodName(9)); - Logger.INFO(ReflectionUtils.getMethodName(10)); - Logger.INFO(ReflectionUtils.getMethodName(11)); - Logger.INFO(ReflectionUtils.getMethodName(12)); - Logger.INFO(ReflectionUtils.getMethodName(13)); - Logger.INFO(ReflectionUtils.getMethodName(14)); - Logger.INFO(ReflectionUtils.getMethodName(15)); + try { + Logger.INFO("=========================================================="); + Logger.INFO("[GT++ CRASH]"); + Logger.INFO("=========================================================="); + Logger.INFO("Oooops..."); + Logger.INFO("This should only happy in a development environment or when something really bad happens."); + Logger.INFO("Reason: "+aReason); + Logger.INFO("=========================================================="); + Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1)); + Logger.INFO(ReflectionUtils.getMethodName(2)); + Logger.INFO(ReflectionUtils.getMethodName(3)); + Logger.INFO(ReflectionUtils.getMethodName(4)); + Logger.INFO(ReflectionUtils.getMethodName(5)); + Logger.INFO(ReflectionUtils.getMethodName(6)); + Logger.INFO(ReflectionUtils.getMethodName(7)); + Logger.INFO(ReflectionUtils.getMethodName(8)); + Logger.INFO(ReflectionUtils.getMethodName(9)); + Logger.INFO(ReflectionUtils.getMethodName(10)); + Logger.INFO(ReflectionUtils.getMethodName(11)); + Logger.INFO(ReflectionUtils.getMethodName(12)); + Logger.INFO(ReflectionUtils.getMethodName(13)); + Logger.INFO(ReflectionUtils.getMethodName(14)); + Logger.INFO(ReflectionUtils.getMethodName(15)); + } + catch (Throwable t) { + t.printStackTrace(); + } FMLCommonHandler.instance().exitJava(0, true); } diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 1ef925f793..aaec2024e4 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -335,6 +335,9 @@ public class ReflectionUtils { public static String getMethodName(final int depth) { final StackTraceElement[] ste = new Throwable().getStackTrace(); //System. out.println(ste[ste.length-depth].getClassName()+"#"+ste[ste.length-depth].getMethodName()); + if (ste.length < depth) { + return "No valid stack."; + } return ste[depth+1].getMethodName(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index d42ea35a78..999d80199f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -54,6 +54,7 @@ import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; +import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator; import gtPlusPlus.xmod.gregtech.loaders.Gregtech_Blocks; @@ -176,6 +177,7 @@ public class HANDLER_GT { convertPyroToCokeOven(); generateElementalDuplicatorRecipes(); Meta_GT_Proxy.fixIC2FluidNames(); + GT_ComputercubeDescription.addStandardDescriptions(); RecipeLoader_AlgaeFarm.generateRecipes(); if (LoadedMods.AdvancedSolarPanel) { RecipeLoader_MolecularTransformer.run(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 7a7ae278c0..c61195a9e8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -105,6 +105,7 @@ public enum GregtechItemList implements GregtechItemContainer { //Computer Cube Gregtech_Computer_Cube, + Gregtech_Computer_Cube_Machine, //Casings for batteries Battery_Casing_Gem_1, Battery_Casing_Gem_2, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java new file mode 100644 index 0000000000..5c5c7961d8 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -0,0 +1,314 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { + + public int mEUOut; + + public int mHeat; + + public int mMaxHeat; + + public int mHEM; + + public int mExplosionStrength; + + public int mEU; + + public int mProgress; + + public int mID; + + public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { + super(aInventoryPlayer, aTileEntity); + mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + int y; + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); + switch (this.mID) { + case 1: + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 86, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 70, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 54, false, false, 1)); + for (y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); + } + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 113, 153, 28, false, false, 64)); + break; + case 2: + addSlotToContainer(new Slot((IInventory)this.mTileEntity, 54, 8, 28)); + addSlotToContainer(new Slot((IInventory)this.mTileEntity, 55, 26, 28)); + addSlotToContainer(new GT_Slot_Output((IInventory)this.mTileEntity, 56, 134, 28)); + addSlotToContainer(new GT_Slot_Output((IInventory)this.mTileEntity, 57, 152, 28)); + break; + case 3: + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + case 4: + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 152, 35, false, false, 64)); + break; + case 5: + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 190, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 206, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 206, 38, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 206, 56, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 206, 74, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 206, 92, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 206, 110, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 153, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 65, 169, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 66, 185, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 67, 153, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 68, 169, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 69, 185, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 70, 153, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 71, 169, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 72, 185, 39, false, false, 64)); + break; + case 6: + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + } + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + Logger.INFO("Clicked slot "+aSlotIndex); + if (aSlotIndex < 0) { + Logger.INFO(""); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { + Logger.INFO("This ID: "+mID+", Tile: "+((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + return null; + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + ItemStack tStack = tSlot.getStack(); + if (tSlot == null) { + Logger.INFO("Null Slot?"); + } + else { + Logger.INFO("Good Slot!"); + if (aSlotIndex == 0) { + Logger.INFO("Slot is 0"); + if (aMouseclick == 0) { + Logger.INFO("Forward"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); + } else { + Logger.INFO("Backwards"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + //aPlayer.openGui(CORE.MODID, GT_BlockMetaID_Machine.getComputerCubeGUIID((TileEntity)this.mTileEntity), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); + } else if (aSlotIndex <= 2 && this.mID == 3) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 6) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 4) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } + } else if (aSlotIndex <= 2 && this.mID == 5) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } + } else if (aSlotIndex <= 58 && this.mID == 1) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); + onCraftMatrixChanged((IInventory)this.mTileEntity); + } else if (aSlotIndex == 3) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); + } else { + if (aShifthold == 1) { + tSlot.putStack(null); + return null; + } + if (aMouseclick == 0) { + if (tStack == null) { + if (getSlot(58).getStack() != null && aSlotIndex != 58) { + tSlot.putStack(getSlot(58).getStack().copy()); + } else { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + } + return null; + } + for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { + if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) + tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); + return null; + } + } + tSlot.putStack(null); + return null; + } + if (tStack == null) + return null; + if (tStack.stackSize < tStack.getMaxStackSize()) { + tStack.stackSize++; + return null; + } + tStack.stackSize = 1; + return null; + } + } else { + Logger.INFO("Super 2"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + } + Logger.INFO("???"); + return null; + } + + public boolean doesBindPlayerInventory() { + return (this.mID != 1 && this.mID != 5); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + //this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; + this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; + this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; + this.mHEM = (int)(((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); + this.mExplosionStrength = (int)(((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); + this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; + this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = var2.next(); + var1.sendProgressBarUpdate((Container)this, 101, this.mEUOut); + var1.sendProgressBarUpdate((Container)this, 102, this.mHeat & 0xFFFF); + var1.sendProgressBarUpdate((Container)this, 103, this.mMaxHeat & 0xFFFF); + var1.sendProgressBarUpdate((Container)this, 104, this.mHEM); + var1.sendProgressBarUpdate((Container)this, 105, this.mExplosionStrength); + var1.sendProgressBarUpdate((Container)this, 106, this.mHeat >>> 16); + var1.sendProgressBarUpdate((Container)this, 107, this.mMaxHeat >>> 16); + var1.sendProgressBarUpdate((Container)this, 108, this.mEU & 0xFFFF); + var1.sendProgressBarUpdate((Container)this, 109, this.mEU >>> 16); + var1.sendProgressBarUpdate((Container)this, 110, this.mProgress); + //var1.sendProgressBarUpdate((Container)this, 111, this.mEUOut); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 101: + this.mEUOut = par2; + break; + case 102: + this.mHeat = this.mHeat & 0xFFFF0000 | par2; + break; + case 103: + this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; + break; + case 104: + this.mHEM = par2; + break; + case 105: + this.mExplosionStrength = par2; + break; + case 106: + this.mHeat = this.mHeat & 0xFFFF | par2 << 16; + break; + case 107: + this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; + break; + case 108: + this.mEU = this.mEU & 0xFFFF0000 | par2; + case 109: + this.mEU = this.mEU & 0xFFFF | par2 << 16; + break; + case 110: + this.mProgress = par2; + break; + case 111: + //this.mID = par2; + break; + } + } + + public int getSlotStartIndex() { + return 1; + } + + public int getSlotCount() { + return (this.mID == 2) ? 4 : 0; + } + + public int getShiftClickSlotCount() { + return (this.mID == 2) ? 2 : 0; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java new file mode 100644 index 0000000000..0006ce8823 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -0,0 +1,133 @@ +package gtPlusPlus.xmod.gregtech.api.gui.computer; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machine { + public GT_GUIContainer_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { + super(new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), CORE.RES_PATH_GUI + "computer/"+aID+".png"); + if (aID == 5) + this.xSize += 50; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + //GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; + if (tContainer != null) + switch (tContainer.mID) { + case 0 : + this.fontRendererObj.drawString("G.L.A.D.-OS", 64, 61, 16448255); + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + break; + case 1 : + this.fontRendererObj.drawString("Reactorstats:", 7, 108, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mEU) + "EU at " + tContainer.mEUOut + "EU/t", 7, 120, 16448255); + this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", 7, 136, 16448255); + this.fontRendererObj.drawString("Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); + this.fontRendererObj.drawString("Runtime: " + ((tContainer.mEUOut > 0) ? ((tContainer.mEU / tContainer.mEUOut) / 20.0F) : 0.0F) + "secs", 7, 152, 16448255); + break; + case 2 : + this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); + if (tContainer.mProgress == 0) { + this.fontRendererObj.drawString("Can be used to", 51, 24, 16448255); + this.fontRendererObj.drawString("scan Seedbags", 51, 32, 16448255); + } + else { + this.fontRendererObj.drawString("Progress:", 51, 24, 16448255); + this.fontRendererObj.drawString(tContainer.mProgress + "%", 51, 32, 16448255); + } + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + break; + case 3 : + this.fontRendererObj.drawString("Centrifuge", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(), 7, 23, 16448255); + this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); + break; + case 4 : + this.fontRendererObj.drawString("Fusionreactor", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sFusionRecipes.mRecipeList.size(), 7, 23, 16448255); + this.fontRendererObj.drawString("Start: " + toNumber(tContainer.mEU) + "EU", 7, 31, 16448255); + this.fontRendererObj.drawString("EU/t: " + toNumber(tContainer.mEUOut), 7, 39, 16448255); + this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + " Ticks", 7, 47, 16448255); + if (tContainer.mEUOut < 0) { + this.fontRendererObj.drawString("IN: " + toNumber(-tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 55, 16448255); + break; + } + this.fontRendererObj.drawString("OUT: " + toNumber(tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 55, 16448255); + break; + case 5 : + if (tContainer.mMaxHeat >= 0 && tContainer.mMaxHeat < GT_ComputercubeDescription.sDescriptions.size()) + for (int i = 0; i < ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription.length; i++) { + if (i == 0) { + this.fontRendererObj.drawString(((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7, 16448255); + } + else { + this.fontRendererObj.drawString(((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7 + + 8 * i, 16448255); + } + } + break; + case 6 : + this.fontRendererObj.drawString("Electrolyzer", 7, 7, 16448255); + this.fontRendererObj.drawString("Recipe: " + (tContainer.mMaxHeat + 1) + "/" + GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(), 7, 23, 16448255); + this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); + break; + } + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (mContainer != null) { + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + mGUIbackground = new ResourceLocation(mGUIbackgroundPath = CORE.RES_PATH_GUI + "computer/"+ ((GT_Container_ComputerCube) this.mContainer).mID + ".png"); + + switch (tContainer.mID) { + case 5 : + if (tContainer.mExplosionStrength != 0) + drawTexturedModalRect(x + 152, y + 6, 0, 166, 50, 50); + break; + } + } + + } + + public String toNumber(int aNumber) { + String tString = ""; + boolean temp = true, negative = false; + if (aNumber < 0) { + aNumber *= -1; + negative = true; + } + int i; + for (i = 1000000000; i > 0; i /= 10) { + int tDigit = aNumber / i % 10; + if (temp && tDigit != 0) + temp = false; + if (!temp) { + tString = tString + tDigit; + if (i != 1) { + int j; + for (j = i; j > 0;) { + if (j == 1) + tString = tString + ","; + j /= 1000; + } + } + } + } + if (tString.equals("")) + tString = "0"; + return negative ? ("-" + tString) : tString; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index e2ca92d8b0..ec7115cb0f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -1690,7 +1690,7 @@ public abstract class GregtechMeta_MultiBlockBase 0 ? !mMufflerHatches.isEmpty() : true); } public boolean addToMachineListInternal(ArrayList aList, final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 84c0686d61..8f68b646f9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -432,6 +432,7 @@ public class TexturesGtBlock { public static final CustomIcon Casing_Electric_Auto_Workbench_Side = new CustomIcon("TileEntities/gt4/OVERLAY_SIDE_CABINET"); + public static final CustomIcon Casing_Computer_Cube = new CustomIcon("TileEntities/gt4/computer"); public static final CustomIcon Casing_CropHarvester_Cutter = new CustomIcon("TileEntities/gt4/OVERLAY_CROP"); public static final CustomIcon Casing_CropHarvester_Boxes = new CustomIcon("TileEntities/gt4/OVERLAY_BOXES"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java new file mode 100644 index 0000000000..ba48df1311 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java @@ -0,0 +1,189 @@ +package gtPlusPlus.xmod.gregtech.common.computer; + +import java.util.ArrayList; + +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.ItemStack; + +public class GT_ComputercubeDescription { + public static ArrayList sDescriptions = new ArrayList(); + + public String[] mDescription; + + public ItemStack[] mStacks; + + public GT_ComputercubeDescription(String[] aDescription, ItemStack[] aStacks) { + this.mDescription = aDescription; + this.mStacks = aStacks; + sDescriptions.add(this); + } + + public static void addStandardDescriptions() { + Logger.INFO("Adding Default Description Set of the Computer Cube"); + new GT_ComputercubeDescription(new String[] { + "Lightning Rod", "Also known as the Bane of", "Alblaka. The Lightning Rod", "enables you to gain Energy", "from Lightning! To set it up", "you just need the Block", "itself, 4 HV-Transformers", "and a crapton of Ironfences,", "which you then place on top", "of it. After that you have to", + "wait for a Thunderstorm and", "when you are lucky you get", "2.5 MFSU of Energy out of", "it. If a Rod is high enough", "then Rain is also enough to", "get stroke, but with less", "probability ofcourse." }, new ItemStack[] { + GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), ItemList.Machine_IV_LightningRod.get(1), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Quantum Chest", "You want to store tons of", "Materials into your Chests", "but you hate the Item limit", "of them? Not anymore! The", "Quantum Chest is able to", "store an INFINITE* amount", "of one single Item type per", "Chest.", "This Chest stores your Items", + "like Data and ever has a", "Stack of the Item ready for", "extraction. It is compatible", "with any Item that doesnt", "have a NBT-Tag. You ask what", "NBT is? I know it, thats enough.", "* = 2147483391" }, new ItemStack[] { + null, null, null, null, ItemList.Quantum_Chest_LV.get(1), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Computer Cube", "The Device you are", "currently using. This Computer", "is running the G.L.A.D.-OS,", "which is containing many", "usefull Apps:", "- Reactor Planner", "- Seedbag Scanner", "- Recipelists for GT-Devices", "- ", + "- ", "- ", "- ", "- ", "And the Description List you", "are currently reading.", "~This Device has private Access~" }, new ItemStack[] { + null, null, null, null, GregtechItemList.Gregtech_Computer_Cube.get(1), null, null, null, null, null, + null, null, null, null }); + /* new GT_ComputercubeDescription(new String[] { + "UUM-Assembler", "It's like an automatic", "Crafting Table just for UUM", "It can store 20 UUM-Recipes", "and produces those on demand", "It costs 512EU per used piece", "of Universal-Usable-Matter(TM).", "The integrated Quantum Chest", "allows it to store all your", "UUM inside it.", + "Top and Bottom are for Input,", "while the Output is on the", "Sides. The Output is designed,", "to work with RP-Managers, so", "build it into your recursive", "Autocraftingsystem.", "" }, new ItemStack[] { + null, null, null, GT_ModHandler.getIC2Item("matter", 1), new ItemStack(GregTech_API.sBlockList[1], 1, 5), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Sonictron", "You like Music? Then the", "Sonictron 9001 is your best", "choice! You can compose Alarms,", "Doorbell Sounds or boring", "Elevator Music, with the 64 Slots", "inside it. Just leftclick them", "to switch the Sound, rightclick", "them to switch the modulation", "and shiftclick to remove it.", + "Then apply Redstone to play", "With the mobile Version you can", "play sounds everywhere, after", "you copied them from a normal", "Sonictron via rightclicking", "Sneakrightclicking pastes", "Emits Redstone when finished." }, new ItemStack[] { + null, null, null, GregTech_API.getGregTechItem(32, 1, 0), new ItemStack(GregTech_API.sBlockList[1], 1, 6), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "L.E.S.U.", "The unlaggiest Multiblock ever!", "One Controllerblock, and as many", "'stupid' Storageblocks as you want.", "To use it, place one Controller", "and then place the LESU-Storages", "adjacent to it or other placed", "LESU-Storages. The Tier (max EU/t)", "of it depends on the amount of", "adjacent Storages. The", + "Storageblocks are NOT TileEntities,", "what means that they cause as much", "Lag as a random Dirtblock. And the", "Controller Block only checks ONCE", "for the Storages, so no", "Blockiterationlag, AT. ALL. Anyone,", "who says that they lag gets murdered!" }, new ItemStack[] { + null, null, null, new ItemStack(GregTech_API.sBlockList[0], 1, 6), new ItemStack(GregTech_API.sBlockList[1], 1, 7), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "I.D.S.U.", "The Interdimensional Storage Unit", "is a Device, which is like a", "wireless, crossdimensional and", "enderchestlike EU-Storage Block", "", "Every Player has one Network of", "these. The ID is determined by", "the Hashcode of the Name from the", "first Player, who opens it's GUI", + "", "It stores up to 1 Billion EU", "and emits EV. But you need at", "least two of them for Energy", "Transfer", "", "" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 8), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "A.E.S.U.", "The Adjustable Energy Storage Unit", "is like 10 MFSU and has an", "adjustable Output between 0 and", "2048EU/t. You could use it as a", "Transformer. It is Tier-IV, so", "it's basically needed to charge", "Energy Orbs and Lapotron Packs", "", "Not much else to say about it.", + "", "", "", "", "", "", "" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 9), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Charge-O-Mat", "An automatable Charging Bench", "It puts (de-)charged Tools into", "the right Outputslots, which are", "accessible on the Sides of it.", "", "The Energy Orb inside stores enough", "to charge your QSuit almost instantly", "", "This is a Tier-V Charging Station", + "even when the Max-IN/OUT is only", "2048EU/t. It also charges your Armor", "when you are standing close to it.", "", "If you apply Redstone, then it", "decharges instead.", "" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 10), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Centrifuge", "This is a Machine to seperate", "Isotopes.", "", "It has a maximum Consumption Rate", "of 5EU/t, and its Maxinput is", "32EU/t. The time it needs depends", "on the Recipe you use.", "", "It needs Tin Cells for some Recipes,", + "which you put in the Top Left Slot", "", "Top = Input", "Bottom = Tin Cells", "Side = Output", "", "You can pipe Lava into this Device" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 11), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Electrolyzer", "This is a Machine to seperate", "Molecules and electrolyze", "Watercells.", "", "It has a maximum Consumption Rate", "of 128EU/t, and its Maxinput is", "128EU/t. The time it needs depends", "on the Recipe you use.", "", + "It needs Tin Cells for some Recipes,", "which you put in the Bottom Left Slot", "", "Top = Input", "Bottom = Tin Cells", "Side = Output", "" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 25), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Grinder", "This Machines purpose is to", "macerate and grind Ores.", "It can ONLY grind Ores, don't", "try regular Macerator Recipes.", "It has a fixed Consumption Rate", "of 128EU/t, and its Maxinput is", "128EU/t. The time it needs is", "5 seconds per Ore Block", "It needs Water for most Recipes,", + "which you put in the Bottom Left Slot", "Top = Input", "Bottom = Water", "Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] { + null, new ItemStack(Block.field_71943_B, 1), new ItemStack(GregTech_API.sBlockList[0], 1, 14), new ItemStack(GregTech_API.sBlockList[0], 1, 13), new ItemStack(GregTech_API.sBlockList[1], 1, 28), null, null, null, null, null, + null, null, null, null });*/ + new GT_ComputercubeDescription(new String[] { + "Electric Blast Furnace", "You may know the Blast Furnace", "of Railcraft. This one works", "similar, as it can also produce", "Steel out of Iron and Coal.", "", "Its heat Capacity depends on the", "used Machine Casings for building", "it. The better they are, the more", "Heat it can achieve.", + "", "Top = Input 1", "Bottom = Input 2", "Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] { + null, null, null, null, ItemList.Machine_Multi_BlastFurnace.get(1), null, null, null, null, null, + null, null, null, null }); + /* new GT_ComputercubeDescription(new String[] { + "Sawmill", "This Device turns your Logs", "into more Planks, than a normal", "Steve can produce with his Hands.", "", "Its byproduct, Wood Pulp, can be", "compressed into special Planks,", "which are burning like Charcoal.", "", "It needs Water for most Recipes,", + "which you put in the Bottom Left Slot", "Top = Input", "Water Sides = Water", "Saw Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] { + null, null, GT_MetaItem_Material.instance.getStack(15, 1), GT_MetaItem_Dust.instance.getStack(15, 1), new ItemStack(GregTech_API.sBlockList[1], 1, 32), null, null, null, null, null, + null, null, null, null });*/ + new GT_ComputercubeDescription(new String[] { + "Implosion Compressor", "You need to turn Dusts back", "into Gems? Or do you just want", "to make Iridium Plates?", "With a bit ITNT you can achieve", "that in this Device!", "", "We strongly recommend to use", "Flint Dust instead of Flints", "for making the ITNT.", + "", "Top = Input", "Explosion Sides = Output", "ITNT Side = ITNT Input", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] { + null, null, null, GT_ModHandler.getIC2Item("industrialTnt", 1, new ItemStack(net.minecraft.init.Blocks.tnt, 1)), ItemList.Machine_Multi_ImplosionCompressor.get(1), null, null, null, null, null, + null, null, null, null }); + /* new GT_ComputercubeDescription(new String[] { + "Superconductor", "Expensive, but superconducting", "nearly infinite EU/p and it has", "no Cableloss!", "Do not confuse this with the", "Superconductor Item!", "", "Supercondensator", "This is a special kind of Transformer", "It allows you to convert anything down", + "to 8192 EU/t, what is like a normal HVT.", "But if you apply Redstone to it then it", "outputs friggin 1000000EU/t!!!", "", "You also need it for the Fusion Reactor.", "Some Machines will require that high", "Voltage in a short period of time." }, new ItemStack[] { + null, null, GregTech_API.getGregTechItem(3, 1, 2), new ItemStack(GregTech_API.sBlockList[1], 1, 12), new ItemStack(GregTech_API.sBlockList[1], 1, 15), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Player Detector", "This nice little Device is able", "to detect Players in a Range of", "16-Spherical Meters and a", "EU-Consumption of 2.5EU/t.", "", "It can be switched to 3 Diffrent", "Modes, to detect YOURSELF, OTHERS", "and ALL Players by Rightclicking it.", "", + "It doesnt detect regular Mobs.", "", "", "", "", "", "~This Device has private Access~" }, new ItemStack[] { + null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 13), null, null, null, null, null, + null, null, null, null });*/ + new GT_ComputercubeDescription(new String[] { + "Matter Fabricator", "The Matter Fabricator is nothing", "else than a Mass Fabricator, which", "can ONLY run on Scrap and other", "Amplifiers.", "", "With the Default Config it is 100", "times more expensive than normal.", "Of course you can set the Config", "to 166666, to get your normal", + "Massfabricationrate back, or you", "could make Mass Fabrication even", "cheaper, if you really want to", "make Mass Fabrication that easy", "", "", "" }, new ItemStack[] { + null, null, null, GT_Utility.getFluidDisplayStack(FluidUtils.getUUA(1), false), ItemList.Machine_LV_Massfab.get(1), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Electric Autocrafting Tables", "These are Crafting Tables for the", "common need of autocrafting in", "Factories. One Craft needs 5000EU to", "be performed, so you have actually to", "lay Wires to it. This Table is", "unique as its also able, to give you", "the used Capsulecellcontainers, made", "by Industrial Corp, back.", "You may use that behaviour to", + "craft anything releated to chemics,", "like the 2xKNO3-Recipe for Saltpeter.", "The 5 Modes are the following:", "1. Craft Recipe, 2. All 5 Modes", "3. Craft all as single Items", "4. 2x2-Grid and 5. a 3x3-Grid.", "It accepts only 32EU/p as Input." }, new ItemStack[] { + null, null, null, null, GregtechItemList.GT4_Electric_Auto_Workbench_LV.get(1), null, null, null, null, null, + null, null, null, null }); + /* new GT_ComputercubeDescription(new String[] { + "Automation with GregTech", "Translocators and Buffers are the", "newest Way to automate your Machines.", "Screw Buildcraft, these EU-wasting", "Devices are much more awesome.", "They output 32EU/t to their directed", "IN- and OUT-puts, making them usefull", "for things, like saving wires.", "Translocators are taking Stuff from", "the Block at their green Inputfacing", + "and putting it into the Block at the", "red Outputfacing. Buffers do the same,", "but the grab Items from their own", "Inventory, what makes them usefull", "as Pipe-replacement.", "Buffers also have Redstone Intelligence,", "which you can configure in their GUI." }, new ItemStack[] { + null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 19), new ItemStack(GregTech_API.sBlockList[1], 1, 18), new ItemStack(GregTech_API.sBlockList[1], 1, 17), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Silver Ore", "It's rarity is similar to Gold", "Silver can be used, to make", "Circuits cheaper, or you can use", "it for Redpowerstuff.", "", "", "", "", "", + "", "", "", "", "", "", "" }, new ItemStack[] { + null, null, GT_OreDictUnificator.get("dustSilver", 1), GregTech_API.getGregTechItem(0, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 1), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Sapphires and Rubys", "These spawn exactly like Emeralds.", "But Rubies are found in Deserts,", "while Sapphires can be found in", "Oceans.", "", "They currently make only a cheaper", "Recipe for Energycrystals and", "Lapotroncrystals, but they are", "Redpower Compatible.", + "", "They also sometimes drop random", "other Gems, like Garnet for Ruby", "or green Sapphire for Sapphire", "in addition.", "", "" }, new ItemStack[] { + null, GregTech_API.getGregTechItem(0, 1, 32), new ItemStack(GregTech_API.sBlockList[2], 1, 3), GregTech_API.getGregTechItem(0, 1, 33), new ItemStack(GregTech_API.sBlockList[2], 1, 4), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Bauxite Ore", "The Stuff out of which you can", "produce Aluminium and also", "Titanium.", "You find this Ore in Plains and", "Forests.", "", "If you think Aluminium is useless", "then note, that mobs NEVER spawn", "ontop of an Aluminium Block", + "(Same applies also for Silver-,", "Gem- and Iridium Blocks)", "Production Chain:", "macerating Bauxite Ore", "electrolyzing 24 Bauxite Dust", "smelting Aluminium Dust in a", "Blast Furnace" }, new ItemStack[] { + new ItemStack(GregTech_API.sBlockList[0], 1, 7), GregTech_API.getGregTechItem(0, 1, 18), GregTech_API.getGregTechItem(1, 1, 18), GregTech_API.getGregTechItem(1, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 5), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Titanium", "Produced by centrifuging Bauxitedust", "as a byproduct, this Material can make", "anything much more resistant against", "damage, like Explosions.", "Blocks made of Titaniumingots have a", "large Blastresistance", "", "It can also be used to craft tons of", "mixed Metal Ingots", + "", "", "", "", "", "", "" }, new ItemStack[] { + new ItemStack(GregTech_API.sBlockList[0], 1, 8), GregTech_API.getGregTechItem(0, 1, 19), GregTech_API.getGregTechItem(1, 1, 19), GregTech_API.getGregTechItem(1, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 5), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Iridium Ore", "You can find it only when you", "stripmine very large Areas with", "Quarries and such. There is only", "one in every 5th-10th Chunk.", "It's even more rare in Oceans!", "", "Some people disable the UUM-Recipe", "for Iridium, for making getting it", "an Achievement.", + "", "However Iridium Ore contains traces", "of Platinum, so it's best to use the", "Industrial Grinder for this Ore.", "", "", "" }, new ItemStack[] { + null, null, GT_OreDictUnificator.get("plateAlloyIridium", 1), GT_ModHandler.getIC2Item("iridiumOre", 1), new ItemStack(GregTech_API.sBlockList[2], 1, 2), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Helium Coolant Cell", "These are just cheaper, than the", "Water based Coolant Cells, and can", "also hold six times more Heat.", "", "Helium Cells can also be used for", "making Luminators and Mininglasers", "", "", "", + "", "", "", "", "", "", "" }, new ItemStack[] { + GregTech_API.getGregTechItem(2, 1, 6), GregTech_API.getGregTechItem(2, 1, 3), GregTech_API.getGregTechItem(34, 1, 0), GregTech_API.getGregTechItem(35, 1, 0), GregTech_API.getGregTechItem(36, 1, 0), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Destructopack", "Open its GUI via rightclick and", "dump all the useless Stuff from", "your Inventory into it, instead of", "littering Items into the World.", "", "", "", "", "", + "", "", "", "", "", "", "" }, new ItemStack[] { + null, null, null, null, GregTech_API.getGregTechItem(33, 1, 0), null, null, null, null, null, + null, null, null, null });*/ + new GT_ComputercubeDescription(new String[] { + "Data Orbs", "They store Data.", "", "Rightclick on a Computer Cube, to", "extract a Reactorplan", "", "Sneak-Rightclick on it, to insert", "a Reactorplan", "", "Works also with Sonictrons", + "", "", "", "", "", "", "" }, new ItemStack[] { + null, null, null, null, ItemList.Tool_DataOrb.get(1), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Energy Orbs", "10Million EU in one Orb!", "", "This is a Tier-IV-Energystorage", "So a MFSU is not enough for it!", "", "Use it to create a Lapotron Pack,", "which is like an ultimate Lap Pack!", "", "", + "", "", "", "", "", "", "" }, new ItemStack[] { + null, null, null, ItemList.Energy_LapotronicOrb.get(1), null, null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Iridium Neutron Reflector", "It's used for Fusion Reactor Coils,", "and works like a normal one", "inside a Reactor, but it's also", "INDESTRUCTIBLE*.", "", "", "", "", "", + "", "", "", "", "", "", "* = for weardown" }, new ItemStack[] { + null, null, null, null, ItemList.Neutron_Reflector.get(1), null, null, null, null, null, + null, null, null, null }); + /*new GT_ComputercubeDescription(new String[] { + "Rock Cutter", "You want to get whole Blocks, but", "your Drill is not enchantable?", "The Rock Cutter has an awesome", "SilkTouch-III-Function!", "", "It works like a Drill, but you", "get the whole Block instead of", "'macerated' Ores!", "", + "Put those Blocks into a Macerator", "and double your Diamond Income!", "", "Or better. Use the Industrial", "Grinder to get even more", "Resources!", "" }, new ItemStack[] { + null, null, null, null, GregTech_API.getGregTechItem(46, 1, 0), null, null, null, null, null, + null, null, null, null }); + new GT_ComputercubeDescription(new String[] { + "Tesla Staff", "This completly untested PvP-Weapon", "destroys electric Armor in one hit", "", "The Energy Orb inside it must be", "fully charged to let this work.", "", "We are not responsible for any", "Electrocution Damage to yourself,", "while using it.", + "", "We also dont even know, if this", "Weapon has any effect AT ALL.", "", "", "", "" }, new ItemStack[] { + null, null, null, null, GregTech_API.getGregTechItem(47, 1, 0), null, null, null, null, null, + null, null, null, null });*/ + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java new file mode 100644 index 0000000000..dd8c79a855 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java @@ -0,0 +1,986 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.misc; + +import java.util.ArrayList; +import java.util.Collections; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_ComputerCube; +import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_ComputerCube; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; +import ic2.api.reactor.IReactor; +import ic2.api.reactor.IReactorComponent; +import ic2.core.Ic2Items; +import ic2.core.init.MainConfig; +import ic2.core.util.ConfigUtil; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank implements IReactor { + + public static boolean mSeedscanner = true; + + public static boolean mReactorplanner = true; + + public static ArrayList sReactorList; + + public boolean mStarted = false; + + public int mMode = 0; + + public int mHeat = 0; + + public int mEUOut = 0; + + public int mMaxHeat = 10000; + + public int mEU = 0; + + public int mProgress = 0; + + public int mEUTimer = 0; + + public int mEULast1 = 0; + + public int mEULast2 = 0; + + public int mEULast3 = 0; + + public int mEULast4 = 0; + + public float mHEM = 1.0F, mExplosionStrength = 0.0F; + + private boolean mNeedsUpdate; + + public GT_TileEntity_ComputerCube(final int aID, final String aDescription) { + super(aID, "computer.cube", "Computer Cube", 5, 114, aDescription); + } + + public GT_TileEntity_ComputerCube(final String aName, final String aDescription, final ITexture[][][] aTextures) { + super(aName, 5, 114, aDescription, aTextures); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + try { + return new GT_Container_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode); + } + catch (Throwable t) { + t.printStackTrace(); + return null; + } + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + try { + return new GT_GUIContainer_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode); + } + catch (Throwable t) { + t.printStackTrace(); + return null; + } + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + Logger.INFO("Did rmb."); + boolean aDidOpen = aBaseMetaTileEntity.openGUI(aPlayer); + Logger.INFO("Did open? "+aDidOpen); + return true; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_TileEntity_ComputerCube(this.mName, this.mDescription, this.mTextures); + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + ItemStack tStack = aPlayer.getCurrentEquippedItem(); + if (tStack != null && ItemList.Tool_DataOrb.isStackEqual(tStack)) { + return false; + } + return true; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(byte aDirection) { + return true; + } + + @Override + public long maxAmperesIn() { + return 4; + } + + @Override + public long maxEUInput() { + return GT_Values.V[2]; + } + + @Override + public long maxEUStore() { + return GT_Values.V[5] * 1024; + } + + @Override + public boolean ownerControl() { + return true; + } + + @Override + public int getSizeInventory() { + return 114; + } + + @Override + public boolean isValidSlot(int aIndex) { + return (aIndex > 53 && aIndex < 58); + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + public void saveNuclearReactor() { + for (int i = 0; i < 54; i++) { + if (this.mInventory[i] == null) { + this.mInventory[i + 59] = null; + } + else { + this.mInventory[i + 59] = this.mInventory[i].copy(); + } + } + } + + public void loadNuclearReactor() { + for (int i = 0; i < 54; i++) { + if (this.mInventory[i + 59] == null) { + this.mInventory[i] = null; + } + else { + this.mInventory[i] = this.mInventory[i + 59].copy(); + } + } + } + + public int getXCoord() { + return this.getBaseMetaTileEntity().getXCoord(); + } + + public int getYCoord() { + return this.getBaseMetaTileEntity().getYCoord(); + } + + public int getZCoord() { + return this.getBaseMetaTileEntity().getZCoord(); + } + + public void reset() { + this.mEU = 0; + this.mHeat = 0; + this.mEUOut = 0; + this.mMaxHeat = 10000; + this.mHEM = 1.0F; + this.mExplosionStrength = 0.0F; + this.mProgress = 0; + this.mInventory[113] = null; + int i; + for (i = 0; i < 54; i++) { + this.mInventory[i] = null; + this.mInventory[i + 59] = null; + } + for (i = 54; i < 58; i++) { + if (this.mInventory[i] != null) { + if (!this.getWorld().isRemote) + this.getWorld().spawnEntityInWorld((Entity) new EntityItem(this.getWorld(), this.getXCoord() + 0.5D, this.getYCoord() + 0.5D, this.getZCoord() + 0.5D, this.mInventory[i])); + this.mInventory[i] = null; + } + } + } + + public void switchModeForward() { + this.mMode = (this.mMode + 1) % 7; + switchMode(); + } + + public void switchModeBackward() { + this.mMode--; + if (this.mMode < 0) + this.mMode = 6; + switchMode(); + } + + private void switchMode() { + reset(); + if (this.mMode == 1 && !mReactorplanner) { + switchMode(); + return; + } + if (this.mMode == 2 && !mSeedscanner) { + switchMode(); + return; + } + if (this.mMode == 3) { + showCentrifugeRecipe(0); + } + if (this.mMode == 4) { + showFusionRecipe(0); + } + if (this.mMode == 5) { + showDescription(0); + } + if (this.mMode == 6) { + showElectrolyzerRecipe(0); + } + //this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), (GregTech_API.sBlockList[1]), 10, this.mMode); + //this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), (GregTech_API.sBlockList[1]), 11, this.mMaxHeat); + } + + public void showDescription(int aIndex) { + this.mExplosionStrength = 0.0F; + if (GT_ComputercubeDescription.sDescriptions.isEmpty()) { + return; + } + if (aIndex >= GT_ComputercubeDescription.sDescriptions.size() || aIndex < 0) + aIndex = 0; + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[0] == null) { + this.mInventory[59] = null; + } + else { + this.mInventory[59] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[0].copy(); + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[1] == null) { + this.mInventory[60] = null; + } + else { + this.mInventory[60] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[1].copy(); + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[2] == null) { + this.mInventory[61] = null; + } + else { + this.mInventory[61] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[2].copy(); + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[3] == null) { + this.mInventory[62] = null; + } + else { + this.mInventory[62] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[3].copy(); + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[4] == null) { + this.mInventory[63] = null; + } + else { + this.mInventory[63] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[4].copy(); + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[5] == null) { + this.mInventory[64] = null; + } + else { + this.mInventory[64] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[5].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[6] == null) { + this.mInventory[65] = null; + } + else { + this.mInventory[65] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[6].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[7] == null) { + this.mInventory[66] = null; + } + else { + this.mInventory[66] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[7].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[8] == null) { + this.mInventory[67] = null; + } + else { + this.mInventory[67] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[8].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[9] == null) { + this.mInventory[68] = null; + } + else { + this.mInventory[68] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[9].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[10] == null) { + this.mInventory[69] = null; + } + else { + this.mInventory[69] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[10].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[11] == null) { + this.mInventory[70] = null; + } + else { + this.mInventory[70] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[11].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[12] == null) { + this.mInventory[71] = null; + } + else { + this.mInventory[71] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[12].copy(); + this.mExplosionStrength = 100.0F; + } + if (((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[13] == null) { + this.mInventory[72] = null; + } + else { + this.mInventory[72] = ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(aIndex)).mStacks[13].copy(); + this.mExplosionStrength = 100.0F; + } + this.mMaxHeat = aIndex; + //this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockList[1], 11, this.mMaxHeat); + } + + public void switchDescriptionPageForward() { + if (++this.mMaxHeat >= GT_ComputercubeDescription.sDescriptions.size()) + this.mMaxHeat = 0; + showDescription(this.mMaxHeat); + } + + public void switchDescriptionPageBackward() { + if (--this.mMaxHeat < 0) + this.mMaxHeat = GT_ComputercubeDescription.sDescriptions.size() - 1; + showDescription(this.mMaxHeat); + } + + public void showCentrifugeRecipe(int aIndex) { + /* + if (aIndex >= GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size() || aIndex < 0) + aIndex = 0; + GT_Recipe tRecipe = GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.get(aIndex); + if (tRecipe != null) { + if (tRecipe.mInput1 == null) { + this.mInventory[59] = null; + } + else { + this.mInventory[59] = tRecipe.mInput1.copy(); + } + if (tRecipe.mInput2 == null) { + this.mInventory[60] = null; + } + else { + this.mInventory[60] = tRecipe.mInput2.copy(); + } + if (tRecipe.mOutput1 == null) { + this.mInventory[61] = null; + } + else { + this.mInventory[61] = tRecipe.mOutput1.copy(); + } + if (tRecipe.mOutput2 == null) { + this.mInventory[62] = null; + } + else { + this.mInventory[62] = tRecipe.mOutput2.copy(); + } + if (tRecipe.mOutput3 == null) { + this.mInventory[63] = null; + } + else { + this.mInventory[63] = tRecipe.mOutput3.copy(); + } + if (tRecipe.mOutput4 == null) { + this.mInventory[64] = null; + } + else { + this.mInventory[64] = tRecipe.mOutput4.copy(); + } + this.mEU = tRecipe.mDuration * 5; + this.mMaxHeat = aIndex; + } + this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat); + */} + + public void switchCentrifugePageForward() { + if (++this.mMaxHeat >= GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size()) + this.mMaxHeat = 0; + // showCentrifugeRecipe(this.mMaxHeat); + } + + public void switchCentrifugePageBackward() { + if (--this.mMaxHeat < 0) + this.mMaxHeat = GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size() - 1; + // showCentrifugeRecipe(this.mMaxHeat); + } + + public void showElectrolyzerRecipe(int aIndex) { + /* + if (aIndex >= GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size() || aIndex < 0) + aIndex = 0; + GT_Recipe tRecipe = GT_Recipe_Map.sElectrolyzerRecipes.get(aIndex); + if (tRecipe != null) { + if (tRecipe.mInput1 == null) { + this.mInventory[59] = null; + } + else { + this.mInventory[59] = tRecipe.mInput1.copy(); + } + if (tRecipe.mInput2 == null) { + this.mInventory[60] = null; + } + else { + this.mInventory[60] = tRecipe.mInput2.copy(); + } + if (tRecipe.mOutput1 == null) { + this.mInventory[61] = null; + } + else { + this.mInventory[61] = tRecipe.mOutput1.copy(); + } + if (tRecipe.mOutput2 == null) { + this.mInventory[62] = null; + } + else { + this.mInventory[62] = tRecipe.mOutput2.copy(); + } + if (tRecipe.mOutput3 == null) { + this.mInventory[63] = null; + } + else { + this.mInventory[63] = tRecipe.mOutput3.copy(); + } + if (tRecipe.mOutput4 == null) { + this.mInventory[64] = null; + } + else { + this.mInventory[64] = tRecipe.mOutput4.copy(); + } + this.mEU = tRecipe.mDuration * tRecipe.mEUt; + this.mMaxHeat = aIndex; + } + this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat); + */} + + public void switchElectrolyzerPageForward() { + if (++this.mMaxHeat >= GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size()) + this.mMaxHeat = 0; + showElectrolyzerRecipe(this.mMaxHeat); + } + + public void switchElectrolyzerPageBackward() { + if (--this.mMaxHeat < 0) + this.mMaxHeat = GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size() - 1; + showElectrolyzerRecipe(this.mMaxHeat); + } + + public static ArrayList sFusionReactorRecipes = new ArrayList(); + + public void showFusionRecipe(int aIndex) { + + if (sFusionReactorRecipes.isEmpty()) { + for (GT_Recipe aRecipe : GT_Recipe_Map.sFusionRecipes.mRecipeList) { + sFusionReactorRecipes.add(aRecipe); + } + Collections.sort(sFusionReactorRecipes); + } + + if (aIndex >= sFusionReactorRecipes.size() || aIndex < 0) { + aIndex = 0; + } + GT_Recipe tRecipe = sFusionReactorRecipes.get(aIndex); + if (tRecipe != null) { + if (tRecipe.mFluidInputs[0] == null) { + this.mInventory[59] = null; + } + else { + this.mInventory[59] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[0], true); + } + if (tRecipe.mFluidInputs[1] == null) { + this.mInventory[60] = null; + } + else { + this.mInventory[60] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[1], true); + } + if (tRecipe.mFluidOutputs[0] == null) { + this.mInventory[61] = null; + } + else { + this.mInventory[61] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[0], true); + } + this.mEU = tRecipe.mSpecialValue; + this.mEUOut = tRecipe.mEUt; + this.mHeat = tRecipe.mDuration; + this.mMaxHeat = aIndex; + } + //this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockList[1], 11, this.mMaxHeat); + } + + public void switchFusionPageForward() { + if (++this.mMaxHeat >= sFusionReactorRecipes.size()) + this.mMaxHeat = 0; + showFusionRecipe(this.mMaxHeat); + } + + public void switchFusionPageBackward() { + if (--this.mMaxHeat < 0) + this.mMaxHeat = sFusionReactorRecipes.size() - 1; + showFusionRecipe(this.mMaxHeat); + } + + public void switchNuclearReactor() { + if (this.mStarted) { + stopNuclearReactor(); + } + else { + startNuclearReactor(); + } + } + + public void startNuclearReactor() { + this.mStarted = true; + this.mHeat = 0; + this.mEU = 0; + } + + public void stopNuclearReactor() { + this.mStarted = false; + } + + public void storeAdditionalData(NBTTagCompound aNBT) { + aNBT.setInteger("mMode", this.mMode); + aNBT.setInteger("mProgress", this.mProgress); + aNBT.setBoolean("mStarted", this.mStarted); + aNBT.setInteger("mEU", this.mEU); + aNBT.setInteger("mHeat", this.mHeat); + aNBT.setInteger("mEUOut", this.mEUOut); + aNBT.setInteger("mMaxHeat", this.mMaxHeat); + aNBT.setFloat("mHEM", this.mHEM); + aNBT.setFloat("mExplosionStrength", this.mExplosionStrength); + } + + public void getAdditionalData(NBTTagCompound aNBT) { + this.mMode = aNBT.getInteger("mMode"); + this.mProgress = aNBT.getInteger("mProgress"); + this.mStarted = aNBT.getBoolean("mStarted"); + this.mEU = aNBT.getInteger("mEU"); + this.mHeat = aNBT.getInteger("mHeat"); + this.mEUOut = aNBT.getInteger("mEUOut"); + this.mMaxHeat = aNBT.getInteger("mMaxHeat"); + this.mHEM = aNBT.getFloat("mHEM"); + this.mExplosionStrength = aNBT.getFloat("mExplosionStrength"); + } + + public void onFirstTickUpdate() { + } + + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + if (sReactorList == null) { + sReactorList = new ArrayList(); + + String[] aIc2Items = new String[]{ + "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple", + "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent", + "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread", + "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/ + }; + + for (String aItem : aIc2Items) { + ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1); + if (!ItemUtils.checkForInvalidItems(aStack)) { + Logger.INFO("Unable to find IC2 Item: " + aItem); + CORE.crash("Unable to find IC2 Item: " + aItem); + } + else { + sReactorList.add(new GT_ItemStack(aStack.copy())); + } + } + + ItemList[] aGtItems = new ItemList[]{ + ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4, + ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.Reactor_Coolant_He_1, + ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1, ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6, + }; + + for (ItemList aItem : aGtItems) { + sReactorList.add(new GT_ItemStack(aItem.get(1))); + } + + } + + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if(this.getBaseMetaTileEntity().isClientSide()) { + this.getWorld().markBlockForUpdate(this.getXCoord(), this.getYCoord(), this.getZCoord()); + this.mNeedsUpdate = false; + } + else { + this.mNeedsUpdate = false; + } + if (this.getBaseMetaTileEntity().isServerSide()) { + if (this.mMode == 2) { + if (this.mInventory[55] == null) { + this.mInventory[55] = this.mInventory[54]; + this.mInventory[54] = null; + } + if (this.mInventory[57] == null) { + this.mInventory[57] = this.mInventory[56]; + this.mInventory[56] = null; + } + + if (mSeedscanner && this.mInventory[55] != null && GT_Utility.areStacksEqual(this.mInventory[55], Ic2Items.cropSeed, true) && this.mInventory[55].getTagCompound() != null) { + if (this.mInventory[55].getTagCompound().getByte("scan") < 4) { + if (this.mProgress >= 100) { + this.mInventory[55].getTagCompound().setByte("scan", (byte) 4); + this.mProgress = 0; + } + else if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(100, false)) { + this.mProgress++; + } + } + else { + this.mProgress = 0; + if (this.mInventory[56] == null) { + this.mInventory[56] = this.mInventory[55]; + this.mInventory[55] = null; + } + } + } + else { + this.mProgress = 0; + if (this.mInventory[56] == null) { + this.mInventory[56] = this.mInventory[55]; + this.mInventory[55] = null; + } + } + } + if (this.mMode == 1 && mReactorplanner && this.mStarted && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(32, false)) + for (int i = 0; i < 25 && this.mStarted; i++) { + this.mEUOut = 0; + this.mMaxHeat = 10000; + this.mHEM = 1.0F; + this.mExplosionStrength = 10.0F; + float tMultiplier = 1.0F; + for (int y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) { + ItemStack tStack = getStackInSlot(x + y * 9); + if (tStack != null) + if (tStack.getItem() instanceof IReactorComponent) { + IReactorComponent tComponent = (IReactorComponent) tStack.getItem(); + tComponent.processChamber(this, tStack, x, y, false); //TODO + float tInfluence = ((IReactorComponent) tStack.getItem()).influenceExplosion(this, tStack); + if (tInfluence > 0.0F && tInfluence < 1.0F) { + tMultiplier *= tInfluence; + } + else { + this.mExplosionStrength += tInfluence; + } + } + else if (tStack.isItemEqual(GT_ModHandler.getIC2Item("nearDepletedUraniumCell", 1)) || tStack.isItemEqual(GT_ModHandler.getIC2Item("reEnrichedUraniumCell", 1))) { + stopNuclearReactor(); + } + else { + setInventorySlotContents(x + y * 9, (ItemStack) null); + } + } + } + this.mEUOut *= getReactorEUOutput(); + if ((this.mEUOut == 0 && this.mEUTimer++ > 20) || this.mHeat >= this.mMaxHeat) + stopNuclearReactor(); + if (this.mEUOut != 0) + this.mEUTimer = 0; + this.mExplosionStrength *= this.mHEM * tMultiplier; + this.mEU += this.mEUOut * 20; + int tEU = this.mEULast1; + this.mEULast1 = this.mEULast2; + this.mEULast2 = this.mEULast3; + this.mEULast3 = this.mEULast4; + this.mEULast4 = this.mEUOut; + this.mEUOut = (this.mEUOut + this.mEULast1 + this.mEULast2 + this.mEULast3 + tEU) / 5; + } + if (aTick % 20L == 0L) { + //this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 10, this.mMode); + //this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat); + } + } + } + + private int getReactorEUOutput() { + return MathUtils.roundToClosestInt(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + } + + @Override + public void receiveClientEvent(byte aEventID, byte aValue) { + super.receiveClientEvent(aEventID, aValue); + if (this.getWorld().isRemote) + switch (aEventID) { + case 10 : + this.mNeedsUpdate = true; + this.mMode = aValue; + break; + case 11 : + this.mMaxHeat = aValue; + break; + } + return; + } + + @Override + public void onValueUpdate(byte aValue) { + super.onValueUpdate(aValue); + this.mNeedsUpdate = true; + } + + @Override + public void onMachineBlockUpdate() { + super.onMachineBlockUpdate(); + this.mNeedsUpdate = true; + } + + public boolean canInsertItem(int i, ItemStack itemstack, int j) { + return (this.mMode == 2) ? ((i == 54 || i == 55)) : false; + } + + public boolean canExtractItem(int i, ItemStack itemstack, int j) { + return (this.mMode == 2) ? ((i == 56 || i == 57)) : false; + } + + public String getInvName() { + return "GregTech_Computercube"; + } + + public int getTexture(int aSide, int aMeta) { + switch (this.mMode) { + case 0 : + return 8; + case 1 : + return 46; + case 2 : + return 45; + } + return 48; + } + + @Override + public ChunkCoordinates getPosition() { + return new ChunkCoordinates(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()); + } + + @Override + public int getHeat() { + return this.mHeat; + } + + @Override + public void setHeat(int aHeat) { + this.mHeat = aHeat; + } + + @Override + public int addHeat(int aAmount) { + this.mHeat += aAmount; + return this.mHeat; + } + + @Override + public int getMaxHeat() { + return this.mMaxHeat; + } + + @Override + public void setMaxHeat(int aMaxHeat) { + this.mMaxHeat = aMaxHeat; + } + + @Override + public float getHeatEffectModifier() { + return this.mHEM; + } + + @Override + public void setHeatEffectModifier(float aHEM) { + this.mHEM = aHEM; + } + + + public int addOutput(int aEnergy) { + this.mEUOut += aEnergy; + return this.mEUOut; + } + + @Override + public ItemStack getItemAt(int x, int y) { + if (x < 0 || x > 8 || y < 0 || y > 5) + return null; + return getStackInSlot(x + y * 9); + } + + @Override + public void setItemAt(int x, int y, ItemStack aStack) { + setInventorySlotContents(x + y * 9, aStack); + } + + @Override + public void explode() { + stopNuclearReactor(); + } + + @Override + public int getTickRate() { + return 1; + } + + @Override + public boolean produceEnergy() { + return true; + } + + public int getProgress() { + return this.mProgress; + } + + public int getMaxProgress() { + return (this.mProgress > 0) ? 100 : 0; + } + + @Override + public float addOutput(float aEnergy) { + this.mEUOut = (int) (this.mEUOut + aEnergy); + return this.mEUOut; + } + + @Override + public World getWorld() { + return this.getBaseMetaTileEntity().getWorld(); + } + + @Override + public void addEmitHeat(int heat) { + + } + + @Override + public float getReactorEnergyOutput() { + return this.mEUOut; + } + + @Override + public double getReactorEUEnergyOutput() { + return 0; + } + + @Override + public void setRedstoneSignal(boolean redstone) { + + } + + @Override + public boolean isFluidCooled() { + return false; + } + + + + @Override + public boolean doesFillContainers() { + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @Override + public boolean canTankBeFilled() { + return false; + } + + @Override + public boolean canTankBeEmptied() { + return false; + } + + @Override + public boolean displaysItemStack() { + return false; + } + + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getSides(i); + rTextures[2][i + 1] = this.getSides(i); + rTextures[3][i + 1] = this.getSides(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFront(i); + rTextures[6][i + 1] = this.getSides(i); + rTextures[7][i + 1] = this.getSides(i); + rTextures[8][i + 1] = this.getSides(i); + rTextures[9][i + 1] = this.getSides(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + public ITexture[] getFront(final byte aColor) { + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_3)}; + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Computer_Cube)}; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index 6741a3e433..5c34ce70fe 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -5,6 +5,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricAutoWorkbench; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; @@ -12,6 +13,7 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_ThermalBoiler; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneButtonPanel; import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneLamp; import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneStrengthDisplay; @@ -40,9 +42,16 @@ public class Gregtech4Content { basic(); automation(); redstone(); + computer(); } } + + private static void computer() { + Logger.INFO("Gregtech 4 Content | Registering Computer Cube."); + GregtechItemList.Gregtech_Computer_Cube_Machine.set(new GT_TileEntity_ComputerCube(31130, "C-O-M-P-U-T-E-R").getStackForm(1L)); + } + private static void workbenches() { // Gregtech 4 Workbenches Logger.INFO("Gregtech 4 Content | Registering Workbenches."); diff --git a/src/main/resources/assets/miscutils/textures/blocks/TileEntities/gt4/computer.png b/src/main/resources/assets/miscutils/textures/blocks/TileEntities/gt4/computer.png new file mode 100644 index 0000000000..76ebee594c Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/blocks/TileEntities/gt4/computer.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/0.png b/src/main/resources/assets/miscutils/textures/gui/computer/0.png new file mode 100644 index 0000000000..8f8a4a8f75 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/0.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/1.png b/src/main/resources/assets/miscutils/textures/gui/computer/1.png new file mode 100644 index 0000000000..249e8fc4f1 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/1.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/2.png b/src/main/resources/assets/miscutils/textures/gui/computer/2.png new file mode 100644 index 0000000000..a128743fef Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/2.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/3.png b/src/main/resources/assets/miscutils/textures/gui/computer/3.png new file mode 100644 index 0000000000..bf176cd722 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/3.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/4.png b/src/main/resources/assets/miscutils/textures/gui/computer/4.png new file mode 100644 index 0000000000..93156df2fe Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/4.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/5.png b/src/main/resources/assets/miscutils/textures/gui/computer/5.png new file mode 100644 index 0000000000..eb4dd0d086 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/5.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/6.png b/src/main/resources/assets/miscutils/textures/gui/computer/6.png new file mode 100644 index 0000000000..0eda26a397 Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/6.png differ diff --git a/src/main/resources/assets/miscutils/textures/gui/computer/Redstone.png b/src/main/resources/assets/miscutils/textures/gui/computer/Redstone.png new file mode 100644 index 0000000000..cd287a0a2e Binary files /dev/null and b/src/main/resources/assets/miscutils/textures/gui/computer/Redstone.png differ -- cgit From 3e519e890249825dc8face0087cc631684d36e8c Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 13 Jan 2022 00:28:02 +0000 Subject: Basically finished work on Reactor Simulator. --- .../Ic2ExpReactorPlanner/AutomationSimulator.java | 759 +++++++ .../java/Ic2ExpReactorPlanner/BigintStorage.java | 60 + .../java/Ic2ExpReactorPlanner/Bundle.properties | 411 ++++ .../java/Ic2ExpReactorPlanner/BundleHelper.java | 43 + .../Ic2ExpReactorPlanner/Bundle_zh_CN.properties | 373 ++++ .../Ic2ExpReactorPlanner/ComponentFactory.java | 224 ++ .../java/Ic2ExpReactorPlanner/MaterialsList.java | 302 +++ src/main/java/Ic2ExpReactorPlanner/Reactor.java | 763 +++++++ .../Ic2ExpReactorPlanner/ReactorPlannerFrame.form | 2260 ++++++++++++++++++++ .../java/Ic2ExpReactorPlanner/SimulationData.java | 81 + .../java/Ic2ExpReactorPlanner/TaloniusDecoder.java | 26 + .../components/Condensator.java | 48 + .../components/CoolantCell.java | 31 + .../Ic2ExpReactorPlanner/components/Exchanger.java | 130 ++ .../Ic2ExpReactorPlanner/components/FuelRod.java | 166 ++ .../Ic2ExpReactorPlanner/components/Plating.java | 49 + .../components/ReactorItem.java | 533 +++++ .../Ic2ExpReactorPlanner/components/Reflector.java | 66 + .../java/Ic2ExpReactorPlanner/components/Vent.java | 110 + src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 15 +- .../core/util/reflect/ReflectionUtils.java | 26 +- .../java/gtPlusPlus/xmod/bartworks/BW_Utils.java | 55 + .../gtPlusPlus/xmod/goodgenerator/GG_Utils.java | 55 + .../java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 2 + .../gui/computer/GT_Container_ComputerCube.java | 12 +- .../gui/computer/GT_GUIContainer_ComputerCube.java | 2 +- .../common/computer/GT_ComputerCube_Setup.java | 74 + .../common/computer/GT_Computercube_Simulator.java | 149 ++ .../misc/GT_TileEntity_ComputerCube.java | 74 +- 29 files changed, 6853 insertions(+), 46 deletions(-) create mode 100644 src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/BigintStorage.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/Bundle.properties create mode 100644 src/main/java/Ic2ExpReactorPlanner/BundleHelper.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/Bundle_zh_CN.properties create mode 100644 src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/MaterialsList.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/Reactor.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/ReactorPlannerFrame.form create mode 100644 src/main/java/Ic2ExpReactorPlanner/SimulationData.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/TaloniusDecoder.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/Condensator.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/CoolantCell.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/FuelRod.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/Plating.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/ReactorItem.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/Reflector.java create mode 100644 src/main/java/Ic2ExpReactorPlanner/components/Vent.java create mode 100644 src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java create mode 100644 src/main/java/gtPlusPlus/xmod/goodgenerator/GG_Utils.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java b/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java new file mode 100644 index 0000000000..488de59a8d --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java @@ -0,0 +1,759 @@ +package Ic2ExpReactorPlanner; + +import static Ic2ExpReactorPlanner.BundleHelper.formatI18n; +import static Ic2ExpReactorPlanner.BundleHelper.getI18n; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + +import Ic2ExpReactorPlanner.components.ReactorItem; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; + +/** + * + * @author Brian McCloud + */ +public class AutomationSimulator { + + private final Reactor reactor; + + private final ArrayList output; + + private final GT_TileEntity_ComputerCube mReactor; + + private final boolean[][] alreadyBroken = new boolean[6][9]; + + private final boolean[][] needsCooldown = new boolean[6][9]; + + private final int initialHeat; + + private double minEUoutput = Double.MAX_VALUE; + private double maxEUoutput = 0.0; + private double minHeatOutput = Double.MAX_VALUE; + private double maxHeatOutput = 0.0; + + private final int onPulseDuration; + private final int offPulseDuration; + private final int clockPeriod; + private final int suspendTemp; + private final int resumeTemp; + private final int maxSimulationTicks; + + private boolean reachedBelow50; + private boolean reachedBurn; + private boolean reachedEvaporate; + private boolean reachedHurt; + private boolean reachedLava; + private boolean reachedExplode; + + private boolean allFuelRodsDepleted = false; + private boolean componentsIntact = true; + private boolean anyRodsDepleted = false; + + private int activeTime = 0; + private int inactiveTime = 0; + private int currentActiveTime = 0; + private int minActiveTime = Integer.MAX_VALUE; + private int maxActiveTime = 0; + private int currentInactiveTime = 0; + private int minInactiveTime = Integer.MAX_VALUE; + private int maxInactiveTime = 0; + + private double totalHullHeating = 0; + private double totalComponentHeating = 0; + private double totalHullCooling = 0; + private double totalVentCooling = 0; + + private boolean showHeatingCoolingCalled = false; + + private boolean active = true; + + private int pauseTimer = 0; + + private int redstoneUsed = 0; + + private int lapisUsed = 0; + + private final MaterialsList replacedItems = new MaterialsList(); + + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(getI18n("Simulation.DecimalFormat")); + + private boolean completed = false; + + private boolean mRunning = false; + + private final SimulationData data = new SimulationData(); + public SimulationData getData() { + if (completed) { + return data; + } + return null; + } + + public AutomationSimulator(final Reactor reactor, final ArrayList output2, final GT_TileEntity_ComputerCube aTile) { + this.reactor = reactor; + this.output = output2; + this.mReactor = aTile; + this.initialHeat = (int) reactor.getCurrentHeat(); + this.onPulseDuration = reactor.getOnPulse(); + this.offPulseDuration = reactor.getOffPulse(); + this.clockPeriod = onPulseDuration + offPulseDuration; + this.suspendTemp = reactor.getSuspendTemp(); + this.resumeTemp = reactor.getResumeTemp(); + this.maxSimulationTicks = reactor.getMaxSimulationTicks(); + } + + public void process() { + + mRunning = true; + completed = false; + long startTime = System.nanoTime(); + int reactorTicks = 0; + int cooldownTicks = 0; + int totalRodCount = 0; + + publish(""); // NOI18N + publish(getI18n("Simulation.Started")); + reactor.setCurrentHeat(initialHeat); + reactor.clearVentedHeat(); + double minReactorHeat = initialHeat; + double maxReactorHeat = initialHeat; + reachedBelow50 = false; + reachedBurn = initialHeat >= 0.4 * reactor.getMaxHeat(); + reachedEvaporate = initialHeat >= 0.5 * reactor.getMaxHeat(); + reachedHurt = initialHeat >= 0.7 * reactor.getMaxHeat(); + reachedLava = initialHeat >= 0.85 * reactor.getMaxHeat(); + reachedExplode = false; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + component.clearCurrentHeat(); + component.clearDamage(); + totalRodCount += component.getRodCount(); + } + publish(String.format("R%dC%d:0xC0C0C0", row, col)); // NOI18N + } + } + data.totalRodCount = totalRodCount; + double lastEUoutput = 0.0; + double totalEUoutput = 0.0; + double lastHeatOutput = 0.0; + double totalHeatOutput = 0.0; + double maxGeneratedHeat = 0.0; + double explosionPower = 10.0; + allFuelRodsDepleted = false; + componentsIntact = true; + anyRodsDepleted = false; + Logger.INFO("Reactor Current Heat: "+reactor.getCurrentHeat()); + Logger.INFO("Reactor Max Heat: "+reactor.getMaxHeat()); + Logger.INFO("Least EU Output: "+lastEUoutput); + Logger.INFO("Least Heat Output: "+lastHeatOutput); + Logger.INFO("Reactor Max Ticks: "+maxSimulationTicks); + Logger.INFO("All Fuel Depleted: "+allFuelRodsDepleted); + Logger.INFO("Running: "+isRunning()); + Logger.INFO("Stopped: "+hasStopped()); + while (reactor.getCurrentHeat() < reactor.getMaxHeat() && (!allFuelRodsDepleted || lastEUoutput > 0 || lastHeatOutput > 0) && reactorTicks < maxSimulationTicks && isRunning()) { + //Logger.INFO("Reactor Tick: "+reactorTicks); + reactorTicks++; + reactor.clearEUOutput(); + reactor.clearVentedHeat(); + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + component.preReactorTick(); + } + } + } + if (active) { + allFuelRodsDepleted = true; // assume rods depleted until one is + // found that isn't. + } + double generatedHeat = 0.0; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && !component.isBroken()) { + if (allFuelRodsDepleted && component.getRodCount() > 0) { + allFuelRodsDepleted = false; + } + if (active) { + generatedHeat += component.generateHeat(); + } + component.dissipate(); + component.transfer(); + } + } + } + maxReactorHeat = Math.max(reactor.getCurrentHeat(), maxReactorHeat); + minReactorHeat = Math.min(reactor.getCurrentHeat(), minReactorHeat); + checkReactorTemperature(reactorTicks); + maxGeneratedHeat = Math.max(generatedHeat, maxGeneratedHeat); + if (active) { + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && !component.isBroken()) { + component.generateEnergy(); + } + } + } + } + lastEUoutput = reactor.getCurrentEUoutput(); + totalEUoutput += lastEUoutput; + lastHeatOutput = reactor.getVentedHeat(); + totalHeatOutput += lastHeatOutput; + if (reactor.getCurrentHeat() <= reactor.getMaxHeat()) { + if (reactor.isPulsed() || reactor.isAutomated()) { + if (active) { + activeTime++; + currentActiveTime++; + if (reactor.isPulsed() && (reactor.getCurrentHeat() >= suspendTemp || (reactorTicks % clockPeriod) >= onPulseDuration)) { + active = false; + minActiveTime = Math.min(currentActiveTime, minActiveTime); + maxActiveTime = Math.max(currentActiveTime, maxActiveTime); + currentActiveTime = 0; + } + } + else { + inactiveTime++; + currentInactiveTime++; + if (reactor.isAutomated() && pauseTimer > 0) { + pauseTimer--; + } + else if ((reactor.isPulsed() && reactor.getCurrentHeat() <= resumeTemp && (reactorTicks % clockPeriod) < onPulseDuration)) { + active = true; + minInactiveTime = Math.min(currentInactiveTime, minInactiveTime); + maxInactiveTime = Math.max(currentInactiveTime, maxInactiveTime); + currentInactiveTime = 0; + } + } + } + minEUoutput = Math.min(lastEUoutput, minEUoutput); + maxEUoutput = Math.max(lastEUoutput, maxEUoutput); + minHeatOutput = Math.min(lastHeatOutput, minHeatOutput); + maxHeatOutput = Math.max(lastHeatOutput, maxHeatOutput); + } + calculateHeatingCooling(reactorTicks); + handleAutomation(reactorTicks); + + handleBrokenComponents(reactorTicks, totalHeatOutput, totalRodCount, totalEUoutput, minReactorHeat, maxReactorHeat); + } + + if (hasStopped()) { + publish(formatI18n("Simulation.CancelledAtTick", reactorTicks)); + } + data.minTemp = (int) minReactorHeat; + data.maxTemp = (int) maxReactorHeat; + publish(formatI18n("Simulation.ReactorMinTemp", minReactorHeat)); + publish(formatI18n("Simulation.ReactorMaxTemp", maxReactorHeat)); + if (reactor.getCurrentHeat() < reactor.getMaxHeat()) { + publish(formatI18n("Simulation.TimeWithoutExploding", reactorTicks)); + if (reactor.isPulsed()) { + String rangeString = ""; + if (maxActiveTime > minActiveTime) { + rangeString = formatI18n("Simulation.ActiveTimeRange", minActiveTime, maxActiveTime); + } + else if (minActiveTime < activeTime) { + rangeString = formatI18n("Simulation.ActiveTimeSingle", minActiveTime); + } + publish(formatI18n("Simulation.ActiveTime", activeTime, rangeString)); + rangeString = ""; + if (maxInactiveTime > minInactiveTime) { + rangeString = formatI18n("Simulation.InactiveTimeRange", minInactiveTime, maxInactiveTime); + } + else if (minInactiveTime < inactiveTime) { + rangeString = formatI18n("Simulation.InactiveTimeSingle", minInactiveTime); + } + publish(formatI18n("Simulation.InactiveTime", inactiveTime, rangeString)); + } + final String replacedItemsString = replacedItems.toString(); + if (!replacedItemsString.isEmpty()) { + data.replacedItems = new MaterialsList(replacedItems); + publish(formatI18n("Simulation.ComponentsReplaced", replacedItemsString)); + } + + if (reactorTicks > 0) { + data.totalReactorTicks = reactorTicks; + if (reactor.isFluid()) { + data.totalHUoutput = (int) (40 * totalHeatOutput); + data.avgHUoutput = (int) (2 * totalHeatOutput / reactorTicks); + data.minHUoutput = 2 * minHeatOutput; + data.maxHUoutput = (int) (2 * maxHeatOutput); + if (totalHeatOutput > 0) { + publish(formatI18n("Simulation.HeatOutputs", DECIMAL_FORMAT.format(40 * totalHeatOutput), DECIMAL_FORMAT.format(2 * totalHeatOutput / reactorTicks), DECIMAL_FORMAT.format(2 + * minHeatOutput), DECIMAL_FORMAT.format(2 * maxHeatOutput))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalHeatOutput / reactorTicks / 4 / totalRodCount, minHeatOutput / 4 / totalRodCount, maxHeatOutput / 4 / totalRodCount)); + } + } + } + else { + data.totalEUoutput = (int) totalEUoutput; + data.avgEUoutput = MathUtils.roundToClosestInt(Math.ceil(totalEUoutput / (reactorTicks * 20))); + data.minEUoutput = minEUoutput / 20.0; + data.maxEUoutput = (int) (maxEUoutput / 20.0); + if (totalEUoutput > 0) { + publish(formatI18n("Simulation.EUOutputs", DECIMAL_FORMAT.format(totalEUoutput), DECIMAL_FORMAT.format(totalEUoutput / (reactorTicks * 20)), DECIMAL_FORMAT.format(minEUoutput + / 20.0), DECIMAL_FORMAT.format(maxEUoutput / 20.0))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalEUoutput / reactorTicks / 100 / totalRodCount, minEUoutput / 100 / totalRodCount, maxEUoutput / 100 / totalRodCount)); + } + } + } + } + + if (reactor.getCurrentHeat() > 0.0) { + publish(formatI18n("Simulation.ReactorRemainingHeat", reactor.getCurrentHeat())); + } + double prevReactorHeat = reactor.getCurrentHeat(); + double prevTotalComponentHeat = 0.0; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && !component.isBroken()) { + if (component.getCurrentHeat() > 0.0) { + prevTotalComponentHeat += component.getCurrentHeat(); + publish(String.format("R%dC%d:0xFFA500", row, col)); // NOI18N + component.info.append(formatI18n("ComponentInfo.RemainingHeat", component.getCurrentHeat())); + } + } + } + } + if (prevReactorHeat == 0.0 && prevTotalComponentHeat == 0.0) { + publish(getI18n("Simulation.NoCooldown")); + } + else if (reactor.getCurrentHeat() < reactor.getMaxHeat()) { + double currentTotalComponentHeat = prevTotalComponentHeat; + int reactorCooldownTime = 0; + do { + reactor.clearVentedHeat(); + prevReactorHeat = reactor.getCurrentHeat(); + if (prevReactorHeat == 0.0) { + reactorCooldownTime = cooldownTicks; + } + prevTotalComponentHeat = currentTotalComponentHeat; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && !component.isBroken()) { + component.dissipate(); + component.transfer(); + } + } + } + lastHeatOutput = reactor.getVentedHeat(); + totalHeatOutput += lastHeatOutput; + minEUoutput = Math.min(lastEUoutput, minEUoutput); + maxEUoutput = Math.max(lastEUoutput, maxEUoutput); + minHeatOutput = Math.min(lastHeatOutput, minHeatOutput); + maxHeatOutput = Math.max(lastHeatOutput, maxHeatOutput); + cooldownTicks++; + currentTotalComponentHeat = 0.0; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && !component.isBroken()) { + currentTotalComponentHeat += component.getCurrentHeat(); + if (component.getCurrentHeat() == 0.0 && needsCooldown[row][col]) { + component.info.append(formatI18n("ComponentInfo.CooldownTime", cooldownTicks)); + needsCooldown[row][col] = false; + } + } + } + } + } + while (lastHeatOutput > 0 && cooldownTicks < 50000); + if (reactor.getCurrentHeat() < reactor.getMaxHeat()) { + if (reactor.getCurrentHeat() == 0.0) { + publish(formatI18n("Simulation.ReactorCooldownTime", reactorCooldownTime)); + } + else if (reactorCooldownTime > 0) { + publish(formatI18n("Simulation.ReactorResidualHeat", reactor.getCurrentHeat(), reactorCooldownTime)); + } + publish(formatI18n("Simulation.TotalCooldownTime", cooldownTicks)); + } + } + } + else { + publish(formatI18n("Simulation.ReactorOverheatedTime", reactorTicks)); + explosionPower = 10.0; + double explosionPowerMult = 1.0; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + explosionPower += component.getExplosionPowerOffset(); + explosionPowerMult *= component.getExplosionPowerMultiplier(); + } + } + } + explosionPower *= explosionPowerMult; + publish(formatI18n("Simulation.ExplosionPower", explosionPower)); + } + double totalEffectiveVentCooling = 0.0; + double totalVentCoolingCapacity = 0.0; + double totalCellCooling = 0.0; + double totalCondensatorCooling = 0.0; + + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + if (component.getVentCoolingCapacity() > 0) { + component.info.append(formatI18n("ComponentInfo.UsedCooling", component.getBestVentCooling(), component.getVentCoolingCapacity())); + totalEffectiveVentCooling += component.getBestVentCooling(); + totalVentCoolingCapacity += component.getVentCoolingCapacity(); + } + else if (component.getBestCellCooling() > 0) { + component.info.append(formatI18n("ComponentInfo.ReceivedHeat", component.getBestCellCooling())); + totalCellCooling += component.getBestCellCooling(); + } + else if (component.getBestCondensatorCooling() > 0) { + component.info.append(formatI18n("ComponentInfo.ReceivedHeat", component.getBestCondensatorCooling())); + totalCondensatorCooling += component.getBestCondensatorCooling(); + } + else if (component.getMaxHeatGenerated() > 0) { + if (!reactor.isFluid() && component.getMaxEUGenerated() > 0) { + component.info.append(formatI18n("ComponentInfo.GeneratedEU", component.getMinEUGenerated(), component.getMaxEUGenerated())); + } + component.info.append(formatI18n("ComponentInfo.GeneratedHeat", component.getMinHeatGenerated(), component.getMaxHeatGenerated())); + } + if (component.getMaxReachedHeat() > 0) { + component.info.append(formatI18n("ComponentInfo.ReachedHeat", component.getMaxReachedHeat(), component.getMaxHeat())); + } + } + } + } + + // if (totalVentCoolingCapacity > 0) { + // publish(formatI18n("Simulation.TotalVentCooling", + // totalEffectiveVentCooling, totalVentCoolingCapacity)); + // } + showHeatingCooling(reactorTicks); // Call to show this info in case it + // hasn't already been shown, such + // as for an automated reactor. + if (totalCellCooling > 0) { + publish(formatI18n("Simulation.TotalCellCooling", totalCellCooling)); + } + if (totalCondensatorCooling > 0) { + publish(formatI18n("Simulation.TotalCondensatorCooling", totalCondensatorCooling)); + } + if (maxGeneratedHeat > 0) { + publish(formatI18n("Simulation.MaxHeatGenerated", maxGeneratedHeat)); + } + if (redstoneUsed > 0) { + publish(formatI18n("Simulation.RedstoneUsed", redstoneUsed)); + } + if (lapisUsed > 0) { + publish(formatI18n("Simulation.LapisUsed", lapisUsed)); + } + // double totalCooling = totalEffectiveVentCooling + totalCellCooling + + // totalCondensatorCooling; + // if (totalCooling >= maxGeneratedHeat) { + // publish(formatI18n("Simulation.ExcessCooling", totalCooling - + // maxGeneratedHeat)); + // } else { + // publish(formatI18n("Simulation.ExcessHeating", maxGeneratedHeat - + // totalCooling)); + // } + // return null; + + /* catch (Throwable e) { + if (cooldownTicks == 0) { + publish(formatI18n("Simulation.ErrorReactor", reactorTicks)); + } else { + publish(formatI18n("Simulation.ErrorCooldown", cooldownTicks)); + } + publish(e.toString(), " ", Arrays.toString(e.getStackTrace())); // NO18N + + }*/ + data.explosionPower = (int) explosionPower; + data.totalReactorTicks = reactorTicks; + long endTime = System.nanoTime(); + publish(formatI18n("Simulation.ElapsedTime", (endTime - startTime) / 1e9)); + mRunning = false; + completed = true; + } + + public boolean hasStopped() { + return !mRunning; + } + + public boolean isRunning() { + return mRunning; + } + + private void handleBrokenComponents(final int reactorTicks, final double totalHeatOutput, final int totalRodCount, final double totalEUoutput, final double minReactorHeat, final double maxReactorHeat) { + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && component.isBroken() && !alreadyBroken[row][col]) { + alreadyBroken[row][col] = true; + if (component.getRodCount() == 0) { + publish(String.format("R%dC%d:0xFF0000", row, col)); // NOI18N + component.info.append(formatI18n("ComponentInfo.BrokeTime", reactorTicks)); + if (componentsIntact) { + componentsIntact = false; + data.firstComponentBrokenTime = reactorTicks; + data.firstComponentBrokenRow = row; + data.firstComponentBrokenCol = col; + data.firstComponentBrokenDescription = component.toString(); + publish(formatI18n("Simulation.FirstComponentBrokenDetails", component.toString(), row, col, reactorTicks)); + if (reactor.isFluid()) { + data.prebreakTotalHUoutput = 40 * totalHeatOutput; + data.prebreakAvgHUoutput = 2 * totalHeatOutput / reactorTicks; + data.prebreakMinHUoutput = 2 * minHeatOutput; + data.prebreakMaxHUoutput = 2 * maxHeatOutput; + publish(formatI18n("Simulation.HeatOutputsBeforeBreak", DECIMAL_FORMAT.format(40 * totalHeatOutput), DECIMAL_FORMAT.format(2 * totalHeatOutput + / reactorTicks), DECIMAL_FORMAT.format(2 * minHeatOutput), DECIMAL_FORMAT.format(2 * maxHeatOutput))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalHeatOutput / reactorTicks / 4 / totalRodCount, minHeatOutput / 4 / totalRodCount, maxHeatOutput / 4 + / totalRodCount)); + } + } + else { + data.prebreakTotalEUoutput = totalEUoutput; + data.prebreakAvgEUoutput = totalEUoutput / (reactorTicks * 20); + data.prebreakMinEUoutput = minEUoutput / 20.0; + data.prebreakMaxEUoutput = maxEUoutput / 20.0; + publish(formatI18n("Simulation.EUOutputsBeforeBreak", DECIMAL_FORMAT.format(totalEUoutput), DECIMAL_FORMAT.format(totalEUoutput + / (reactorTicks * 20)), DECIMAL_FORMAT.format(minEUoutput / 20.0), DECIMAL_FORMAT.format(maxEUoutput / 20.0))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalEUoutput / reactorTicks / 100 / totalRodCount, minEUoutput / 100 / totalRodCount, maxEUoutput / 100 + / totalRodCount)); + } + } + } + } + else if (!anyRodsDepleted) { + anyRodsDepleted = true; + data.firstRodDepletedTime = reactorTicks; + data.firstRodDepletedRow = row; + data.firstRodDepletedCol = col; + data.firstRodDepletedDescription = component.toString(); + publish(formatI18n("Simulation.FirstRodDepletedDetails", component.toString(), row, col, reactorTicks)); + if (reactor.isFluid()) { + data.predepleteTotalHUoutput = 40 * totalHeatOutput; + data.predepleteAvgHUoutput = 2 * totalHeatOutput / reactorTicks; + data.predepleteMinHUoutput = 2 * minHeatOutput; + data.predepleteMaxHUoutput = 2 * maxHeatOutput; + publish(formatI18n("Simulation.HeatOutputsBeforeDepleted", DECIMAL_FORMAT.format(40 * totalHeatOutput), DECIMAL_FORMAT.format(2 * totalHeatOutput + / reactorTicks), DECIMAL_FORMAT.format(2 * minHeatOutput), DECIMAL_FORMAT.format(2 * maxHeatOutput))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalHeatOutput / reactorTicks / 4 / totalRodCount, minHeatOutput / 4 / totalRodCount, maxHeatOutput / 4 / totalRodCount)); + } + } + else { + data.predepleteTotalEUoutput = totalEUoutput; + data.predepleteAvgEUoutput = totalEUoutput / (reactorTicks * 20); + data.predepleteMinEUoutput = minEUoutput / 20.0; + data.predepleteMaxEUoutput = maxEUoutput / 20.0; + publish(formatI18n("Simulation.EUOutputsBeforeDepleted", DECIMAL_FORMAT.format(totalEUoutput), DECIMAL_FORMAT.format(totalEUoutput + / (reactorTicks * 20)), DECIMAL_FORMAT.format(minEUoutput / 20.0), DECIMAL_FORMAT.format(maxEUoutput / 20.0))); + if (totalRodCount > 0) { + publish(formatI18n("Simulation.Efficiency", totalEUoutput / reactorTicks / 100 / totalRodCount, minEUoutput / 100 / totalRodCount, maxEUoutput / 100 / totalRodCount)); + } + } + data.predepleteMinTemp = minReactorHeat; + data.predepleteMaxTemp = maxReactorHeat; + publish(formatI18n("Simulation.ReactorMinTempBeforeDepleted", minReactorHeat)); + publish(formatI18n("Simulation.ReactorMaxTempBeforeDepleted", maxReactorHeat)); + } + showHeatingCooling(reactorTicks); + } + } + } + } + + private void handleAutomation(final int reactorTicks) { + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null && reactor.isAutomated()) { + if (component.getMaxHeat() > 1) { + if (component.getAutomationThreshold() > component.getInitialHeat() && component.getCurrentHeat() >= component.getAutomationThreshold()) { + component.clearCurrentHeat(); + replacedItems.add(component.name); + component.info.append(formatI18n("ComponentInfo.ReplacedTime", reactorTicks)); + if (component.getReactorPause() > 0) { + active = false; + pauseTimer = Math.max(pauseTimer, component.getReactorPause()); + minActiveTime = Math.min(currentActiveTime, minActiveTime); + maxActiveTime = Math.max(currentActiveTime, maxActiveTime); + currentActiveTime = 0; + } + } + else if (component.getAutomationThreshold() < component.getInitialHeat() && component.getCurrentHeat() <= component.getAutomationThreshold()) { + component.clearCurrentHeat(); + replacedItems.add(component.name); + component.info.append(formatI18n("ComponentInfo.ReplacedTime", reactorTicks)); + if (component.getReactorPause() > 0) { + active = false; + pauseTimer = Math.max(pauseTimer, component.getReactorPause()); + minActiveTime = Math.min(currentActiveTime, minActiveTime); + maxActiveTime = Math.max(currentActiveTime, maxActiveTime); + currentActiveTime = 0; + } + } + } + else if (component.isBroken() || (component.getMaxDamage() > 1 && component.getCurrentDamage() >= component.getAutomationThreshold())) { + component.clearDamage(); + replacedItems.add(component.name); + component.info.append(formatI18n("ComponentInfo.ReplacedTime", reactorTicks)); + if (component.getReactorPause() > 0) { + active = false; + pauseTimer = Math.max(pauseTimer, component.getReactorPause()); + minActiveTime = Math.min(currentActiveTime, minActiveTime); + maxActiveTime = Math.max(currentActiveTime, maxActiveTime); + currentActiveTime = 0; + } + } + } + if (reactor.isUsingReactorCoolantInjectors() && component != null && component.needsCoolantInjected()) { + component.injectCoolant(); + if ("rshCondensator".equals(component.baseName)) { + redstoneUsed++; + } + else if ("lzhCondensator".equals(component.baseName)) { + lapisUsed++; + } + } + } + } + } + + private void checkReactorTemperature(final int reactorTicks) { + if (reactor.getCurrentHeat() < 0.5 * reactor.getMaxHeat() && !reachedBelow50 && reachedEvaporate) { + publish(formatI18n("Simulation.TimeToBelow50", reactorTicks)); + reachedBelow50 = true; + data.timeToBelow50 = reactorTicks; + } + if (reactor.getCurrentHeat() >= 0.4 * reactor.getMaxHeat() && !reachedBurn) { + publish(formatI18n("Simulation.TimeToBurn", reactorTicks)); + reachedBurn = true; + data.timeToBurn = reactorTicks; + } + if (reactor.getCurrentHeat() >= 0.5 * reactor.getMaxHeat() && !reachedEvaporate) { + publish(formatI18n("Simulation.TimeToEvaporate", reactorTicks)); + reachedEvaporate = true; + data.timeToEvaporate = reactorTicks; + } + if (reactor.getCurrentHeat() >= 0.7 * reactor.getMaxHeat() && !reachedHurt) { + publish(formatI18n("Simulation.TimeToHurt", reactorTicks)); + reachedHurt = true; + data.timeToHurt = reactorTicks; + } + if (reactor.getCurrentHeat() >= 0.85 * reactor.getMaxHeat() && !reachedLava) { + publish(formatI18n("Simulation.TimeToLava", reactorTicks)); + reachedLava = true; + data.timeToLava = reactorTicks; + } + if (reactor.getCurrentHeat() >= reactor.getMaxHeat() && !reachedExplode) { + publish(formatI18n("Simulation.TimeToXplode", reactorTicks)); + reachedExplode = true; + data.timeToXplode = reactorTicks; + } + } + + private void calculateHeatingCooling(final int reactorTicks) { + if (reactorTicks > 20) { + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + totalHullHeating += component.getCurrentHullHeating(); + totalComponentHeating += component.getCurrentComponentHeating(); + totalHullCooling += component.getCurrentHullCooling(); + totalVentCooling += component.getCurrentVentCooling(); + } + } + } + } + } + + private void showHeatingCooling(final int reactorTicks) { + if (!showHeatingCoolingCalled) { + showHeatingCoolingCalled = true; + if (reactorTicks >= 40) { + double totalHullCoolingCapacity = 0; + double totalVentCoolingCapacity = 0; + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 9; col++) { + ReactorItem component = reactor.getComponentAt(row, col); + if (component != null) { + totalHullCoolingCapacity += component.getHullCoolingCapacity(); + totalVentCoolingCapacity += component.getVentCoolingCapacity(); + } + } + } + data.hullHeating = totalHullHeating / (reactorTicks - 20); + data.componentHeating = totalComponentHeating / (reactorTicks - 20); + data.hullCooling = totalHullCooling / (reactorTicks - 20); + data.hullCoolingCapacity = totalHullCoolingCapacity; + data.ventCooling = totalVentCooling / (reactorTicks - 20); + data.ventCoolingCapacity = totalVentCoolingCapacity; + if (totalHullHeating > 0) { + publish(formatI18n("Simulation.HullHeating", totalHullHeating / (reactorTicks - 20))); + } + if (totalComponentHeating > 0) { + publish(formatI18n("Simulation.ComponentHeating", totalComponentHeating / (reactorTicks - 20))); + } + if (totalHullCoolingCapacity > 0) { + publish(formatI18n("Simulation.HullCooling", totalHullCooling / (reactorTicks - 20), totalHullCoolingCapacity)); + } + if (totalVentCoolingCapacity > 0) { + publish(formatI18n("Simulation.VentCooling", totalVentCooling / (reactorTicks - 20), totalVentCoolingCapacity)); + } + } + } + } + + private void publish(String aString) { + output.add(aString); + } + + protected void process(List chunks) { + /* + for (String chunk : chunks) { + if (chunk.isEmpty()) { + output.add(""); // NO18N + } + else { + if (chunk.matches("R\\dC\\d:.*")) { // NO18N + String temp = chunk.substring(5); + int row = chunk.charAt(1) - '0'; + int col = chunk.charAt(3) - '0'; + if (temp.startsWith("0x")) { // NO18N + mReactorComponents[row][col].setBackground(Color.decode(temp)); + if ("0xC0C0C0".equals(temp)) { + mReactorComponents[row][col].setToolTipText(null); + } + else if ("0xFF0000".equals(temp)) { + mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.Broken")); + } + else if ("0xFFA500".equals(temp)) { + mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.ResidualHeat")); + } + } + } + else { + output.add(chunk); + } + } + } + */ + } + + public void cancel() { + Logger.INFO("Stopping Simulation."); + mRunning = false; + completed = true; + } + + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java b/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java new file mode 100644 index 0000000000..03960cd7b1 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java @@ -0,0 +1,60 @@ +package Ic2ExpReactorPlanner; + +import java.math.BigInteger; +import java.util.Base64; + +/** + * Stores numbers of varying size inside a BigInteger, expecting each to have + * a defined limit (which need not be an exact power of 2). Numbers are to be + * extracted in reverse order they were stored, and special values can be used + * to make certain values optional for inclusion (the calling class is + * responsible for handling this logic, though). + * @author Brian McCloud + */ +public class BigintStorage { + private BigInteger storedValue = BigInteger.ZERO; + + /** + * Stores the specified value. Requires that 0 <= value <= max. + * @param value the value to store. + * @param max the expected maximum for the value. + */ + public void store(int value, int max) { + if (value < 0 || value > max) { + throw new IllegalArgumentException(); + } + storedValue = storedValue.multiply(BigInteger.valueOf(max + 1)).add(BigInteger.valueOf(value)); + } + + /** + * Extracts a value based on the specified maximum. + * @param max the expected maximum for the value. + * @return the extracted value. + */ + public int extract(int max) { + BigInteger[] values = storedValue.divideAndRemainder(BigInteger.valueOf(max + 1)); + storedValue = values[0]; + return values[1].intValue(); + } + + /** + * Takes input of a Base64 string, and converts it to a BigintStorage. + * @param code the Base64-encoded string (presumed to be from @outputBase64) + * @return the converted storage object. + */ + public static BigintStorage inputBase64(String code) { + BigintStorage result = new BigintStorage(); + byte[] temp = Base64.getDecoder().decode(code); + result.storedValue = new BigInteger(temp); + return result; + } + + /** + * Outputs the current value of this BigintStorage as a Base64-encoded string. + * @return the Base64-encoded string. + */ + public String outputBase64() { + byte[] temp = storedValue.toByteArray(); + return Base64.getEncoder().encodeToString(temp); + } +} diff --git a/src/main/java/Ic2ExpReactorPlanner/Bundle.properties b/src/main/java/Ic2ExpReactorPlanner/Bundle.properties new file mode 100644 index 0000000000..b20587693f --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/Bundle.properties @@ -0,0 +1,411 @@ + +# Comparison keys are for comparing two simulated reactors. Instead of being in +# in a TextArea like the main simulation, the comparison will be in a JLabel, wrapped +# in html tags, to allow color coding of the text more easily. + +Comparison.CompareDecimalFormat=+#,##0.##;-# +Comparison.ComponentHeating=Component heating: %s (%s/%s)
+Comparison.ComponentsHeading=Components:
+Comparison.ComponentsReplacedHeading=Components replaced:
+Comparison.Default=Please run at least two simulations (preferably with different reactor designs) to get a comparison. +Comparison.EUEUoutput=total output: %s (%s/%s) EU (%s EU/t average (%s/%s), %s EU/t min (%s/%s), %s EU/t max (%s/%s))
+Comparison.EUHUoutput=total output: %s EU / %s HU (%s EU/t / %s HU/t average, %s EU/t / %s HU/t min, %s EU/t / %s HU/t max)
+Comparison.Header=Most recent simulated reactor (left, in-grid) compared to previous simulated reactor (right, in-tab): +Comparison.HUEUoutput=total output: %s HU / %s EU (%s HU/t / %s EU/t average, %s HU/t / %s EU/t min, %s HU/t / %s EU/t max)
+Comparison.HUHUoutput=total output: %s (%s/%s) HU (%s HU/t average (%s/%s), %s HU/t min (%s/%s), %s HU/t max (%s/%s))
+Comparison.HullCooling=Hull cooling: %s (%s/%s)
+Comparison.HullCoolingPossible=Possible hull cooling: %s (%s/%s)
+Comparison.HullHeating=Hull heating: %s (%s/%s)
+Comparison.MaterialsEntry=%s %s (%s/%s)
+Comparison.MaterialsHeading=Materials:
+Comparison.NoDifferences=No significant differences detected. +Comparison.PostsimMaxTemp=Reactor maximum temperature: %s (%s/%s)
+Comparison.PostsimMinTemp=Reactor minimum temperature: %s (%s/%s)
+Comparison.PredepleteMaxTemp=Reactor maximum temperature (before first fuel rod depleted): %s (%s/%s)
+Comparison.PredepleteMinTemp=Reactor minimum temperature (before first fuel rod depleted): %s (%s/%s)
+Comparison.Prefix.PostSimulation=After simulation,\u0020 +Comparison.Prefix.PostSimulationTime=Time simulated:\u0020 +Comparison.Prefix.Prebreak=Before first component broken,\u0020 +Comparison.Prefix.PrebreakTime=Time to first component break:\u0020 +Comparison.Prefix.Predeplete=Before first rod depleted,\u0020 +Comparison.Prefix.PredepleteTime=Time to first rod depletion:\u0020 +Comparison.Prefix.TimeToBelow50=Time to below 50%% heat (after being above it):\u0020 +Comparison.Prefix.TimeToBurn=Time to "Burn" temperature:\u0020 +Comparison.Prefix.TimeToEvaporate=Time to "Evaporate" temperature:\u0020 +Comparison.Prefix.TimeToHurt=Time to "Hurt" temperature:\u0020 +Comparison.Prefix.TimeToLava=Time to "Lava" temperature:\u0020 +Comparison.Prefix.TimeToXplode=Time to explode:\u0020 +Comparison.SimpleDecimalFormat=#,##0.## +Comparison.Time.Both=%+,d seconds (%d/%d)
+Comparison.Time.BothColored=%+,d seconds (%d/%d)
+Comparison.Time.LeftOnly=%d/\u221e
+Comparison.Time.RightOnly=\u221e/%d
+Comparison.VentCooling=Vent cooling: %s (%s/%s)
+Comparison.VentCoolingPossible=Possible vent cooling: %s (%s/%s)
+ +# ComponentData keys are for providing extra details in the tooltips for the component palette. +# Suggested by kekzdealer in Pull Request: https://github.com/MauveCloud/Ic2ExpReactorPlanner/pull/67 +# but heavily modified since. + +ComponentData.AdvancedHeatExchanger=Heat Capacity: 10,000
Hull Exchange Rate: 8 heat/s
Component Exchange Rate: 24 heat/s +ComponentData.AdvancedHeatVent=Heat Capacity: 1,000
Self Venting Rate: 12 heat/s +ComponentData.ComponentHeatExchanger=Heat Capacity: 5,000
Component Exchange Rate: 36 heat/s +ComponentData.ComponentHeatVent=Component Venting Rate: 4 heat/s +ComponentData.ContainmentReactorPlating=Dampens explosions +ComponentData.CoolantCell10k=Heat Capacity: 10,000 +ComponentData.CoolantCell180kHelium=Heat Capacity: 180,000 +ComponentData.CoolantCell180kNak=Heat Capacity: 180,000 +ComponentData.CoolantCell30k=Heat Capacity: 30,000 +ComponentData.CoolantCell360kHelium=Heat Capacity: 360,000 +ComponentData.CoolantCell360kNak=Heat Capacity: 360,000 +ComponentData.CoolantCell60k=Heat Capacity: 60,000 +ComponentData.CoolantCell60kHelium=Heat Capacity: 60,000 +ComponentData.CoolantCell60kNak=Heat Capacity: 60,000 +ComponentData.CoolantCell180kSpace=Heat Capacity: 180,000 +ComponentData.CoolantCell360kSpace=Heat Capacity: 360,000 +ComponentData.CoolantCell540kSpace=Heat Capacity: 540,000 +ComponentData.CoolantCell1080kSpace=Heat Capacity: 1080,000 +ComponentData.DualFuelRodCesium=Generation Time: 10,861 seconds
EU Generation: 40/60/80/100/120 /t
Heat Generation: 6/12/20/30/42 /s +ComponentData.DualFuelRodCoaxium=Generation Time: 20,000 seconds
EU Generation: 20/30/40/50/60 /t
Heat Generation: 0 /s +ComponentData.DualFuelRodMox=Generation Time: 10,000 seconds
EU Generation: [20,100)/[30,150)/[40,200)/[50,250)/[60,300) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 24/48/80/120/168 /s
Heat Generation in fluid reactor when hull temperature>50%: 48/96/160/240/336 /s +ComponentData.DualFuelRodNaquadah=Generation Time: 100,000 seconds
EU Generation: [40,100)/[60,150)/[80,200)/[100,250)/[120,300) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 24/48/80/120/168 /s
Heat Generation in fluid reactor when hull temperature>50%: 48/96/160/240/336 /s +ComponentData.DualFuelRodNaquadahGTNH=Generation Time: 100,000 seconds
EU Generation: 20/30/40/50/60 /t
Heat Generation: 24/48/80/120/168 /s +ComponentData.DualFuelRodNaquadria=Generation Time: 100,000 seconds
EU Generation: [40,100)/[60,150)/[80,200)/[100,250)/[120,300) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 24/48/80/120/168 /s
Heat Generation in fluid reactor when hull temperature>50%: 48/96/160/240/336 /s +ComponentData.DualFuelRodThorium=Generation Time: 50,000 seconds
EU Generation: 4/6/8/10/12 /t
Heat Generation: 6/12/20/30/42 /s +ComponentData.DualFuelRodTiberium=Generation Time: 50,000 seconds
EU Generation: 10/20/30/40/50 /t
Heat Generation: 12/24/40/60/84 /s +ComponentData.DualFuelRodUranium=Generation Time: 20,000 seconds
EU Generation: 20/30/40/50/60 /t
Heat Generation: 24/48/80/120/168 /s +ComponentData.FuelRodCesium=Generation Time: 10,861 seconds
EU Generation: 10/20/30/40/50 /t
Heat Generation: 1/3/8/10/15 /s +ComponentData.FuelRodCoaxium=Generation Time: 20,000 seconds
EU Generation: 5/10/15/20/25 /t
Heat Generation: 0 /s +ComponentData.FuelRodMox=Generation Time: 10,000 seconds
EU Generation: [5,25)/[10,50)/[15,75)/[20,100)/[25,125) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 4/12/24/40/60 /s
Heat Generation in fluid reactor when hull temperature>50%: 8/24/48/80/120 /s +ComponentData.FuelRodNaquadah=Generation Time: 100,000 seconds
EU Generation: [10,25)/[20,50)/[30,75)/[40,100)/[50,125) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 4/12/24/40/60 /s
Heat Generation in fluid reactor when hull temperature>50%: 8/24/48/80/120 /s +ComponentData.FuelRodNaquadahGTNH=Generation Time: 100,000 seconds
EU Generation: 5/10/15/20/25 /t
Heat Generation: 4/12/24/40/60 /s +ComponentData.FuelRodNaquadria=Generation Time: 100,000 seconds
EU Generation: [10,25)/[20,50)/[30,75)/[40,100)/[50,125) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 4/12/24/40/60 /s
Heat Generation in fluid reactor when hull temperature>50%: 8/24/48/80/120 /s +ComponentData.FuelRodTheCore=Generation Time: 100,000 seconds
EU Generation: 10880 /t
Heat Generation: 19584 /s +ComponentData.FuelRodThorium=Generation Time: 50,000 seconds
EU Generation: 1/2/3/4/5 /t
Heat Generation: 1/3/6/10/15 /s +ComponentData.FuelRodTiberium=Generation Time: 50,000 seconds
EU Generation: 5/10/15/20/25 /t
Heat Generation: 2/6/12/20/30 /s +ComponentData.FuelRodUranium=Generation Time: 20,000 seconds
EU Generation: 5/10/15/20/25 /t
Heat Generation: 4/12/24/40/60 /s +ComponentData.HeatCapacityReactorPlating=Increases maximum heat capacity +ComponentData.HeatExchanger=Heat Capacity: 2,500
Hull Exchange Rate: 4 heat/s
Component Exchange Rate: 12 heat/s +ComponentData.HeatVent=Heat Capacity: 1,000
Self Venting Rate: 6 heat/s +ComponentData.IridiumNeutronReflector=Durability: Infinite +ComponentData.LzhCondensator=Heat Capacity: 100,000
Cannot be vented from. +ComponentData.NeutronReflector=Durability: 30,000 (10,000 in MC 1.7.10) +ComponentData.OverclockedHeatVent=Heat Capacity: 1,000
Self Venting Rate: 20 heat/s
Hull Cooling Rate: 36 heat/s +ComponentData.QuadFuelRodCesium=Generation Time: 10,861 seconds
EU Generation: 120/160/200/240/280 /t
Heat Generation: 24/40/60/84/112 /s +ComponentData.QuadFuelRodCoaxium=Generation Time: 20,000 seconds
EU Generation: 60/80/100/120/140 /t
Heat Generation: 0 /s +ComponentData.QuadFuelRodMox=Generation Time: 10,000 seconds
EU Generation: [60,300)/[80,400)/[100,500)/[120,600)/[140,700) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 96/160/240/336/448 /s
Heat Generation in fluid reactor when hull temperature>50%: 192/320/480/672/896 /s +ComponentData.QuadFuelRodNaquadah=Generation Time: 100,000 seconds
EU Generation: [120,300)/[160,400)/[200,500)/[240,600)/[280,700) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 96/160/240/336/448 /s
Heat Generation in fluid reactor when hull temperature>50%: 192/320/480/672/896 /s +ComponentData.QuadFuelRodNaquadahGTNH=Generation Time: 100,000 seconds
EU Generation: 60/80/100/120/140 /t
Heat Generation: 96/160/240/336/448 /s +ComponentData.QuadFuelRodNaquadria=Generation Time: 100,000 seconds
EU Generation: [120,300)/[160,400)/[200,500)/[240,600)/[280,700) /t - scales linearly with hull temperature.
Heat Generation in EU reactor or when hull temperature<=50%: 96/160/240/336/448 /s
Heat Generation in fluid reactor when hull temperature>50%: 192/320/480/672/896 /s +ComponentData.QuadFuelRodThorium=Generation Time: 50,000 seconds
EU Generation: 12/16/20/24/28 /t
Heat Generation: 24/40/60/84/112 /s +ComponentData.QuadFuelRodTiberium=Generation Time: 50,000 seconds
EU Generation: 60/80/100/120/140 /t
Heat Generation: 48/80/120/168/224 /s +ComponentData.QuadFuelRodUranium=Generation Time: 20,000 seconds
EU Generation: 60/80/100/120/140 /t
Heat Generation: 96/160/240/336/448 /s +ComponentData.ReactorHeatExchanger=Heat Capacity: 5,000
Hull Exchange Rate: 72 heat/s +ComponentData.ReactorHeatVent=Heat Capacity: 1,000
Self Venting Rate: 5 heat/s
Hull Cooling Rate: 5 heat/s +ComponentData.ReactorPlating=Crafting component for Containment and Heat-Capacity Reactor Plating +ComponentData.RshCondensator=Heat Capacity: 20,000
Cannot be vented from. +ComponentData.ThickNeutronReflector=Durability: 120,000 (40,000 in MC 1.7.10) + +# ComponentInfo keys are for updating information about a component during a simulation. + +ComponentInfo.BrokeTime=\nBroke after %,d seconds. +ComponentInfo.CooldownTime=\nTook %,d seconds to cool down. +ComponentInfo.GeneratedEU=\nGenerated %,.2f to %,.2f EU per second. +ComponentInfo.GeneratedHeat=\nGenerated %,.0f to %,.0f heat per second. +ComponentInfo.ReachedHeat=\nReached up to %,.0f of %,.0f heat. +ComponentInfo.ReceivedHeat=\nReceived at most %,.0f heat per second. +ComponentInfo.RemainingHeat=\nHad %,.0f heat left after main simulation stopped. +ComponentInfo.ReplacedTime=\nReplaced at %,d seconds. +ComponentInfo.ResidualHeat=\nHad %,.0f heat left after cooldown period. +ComponentInfo.UsedCooling=\nUsed %,.0f of %,.0f cooling. + + +# Keys for component names were originally matched to class names, to allow using reflection to look them up. +# However, refactoring eliminated the "one class for each component type" idea. +# These keys will be used both in the reactor area and the component selection area. + +ComponentName.AdvancedHeatExchanger=Advanced Heat Exchanger +ComponentName.AdvancedHeatVent=Advanced Heat Vent +ComponentName.ComponentHeatExchanger=Component Heat Exchanger +ComponentName.ComponentHeatVent=Component Heat Vent +ComponentName.ContainmentReactorPlating=Containment Reactor Plating +ComponentName.CoolantCell10k=10k Coolant Cell +ComponentName.CoolantCell1080kSpace=1080k Space Coolant Cell +ComponentName.CoolantCell180kHelium=180k He Coolant Cell +ComponentName.CoolantCell180kNak=180k NaK Coolant Cell +ComponentName.CoolantCell180kSpace=180k Space Coolant Cell +ComponentName.CoolantCell30k=30k Coolant Cell +ComponentName.CoolantCell360kHelium=360k He Coolant Cell +ComponentName.CoolantCell360kNak=360k NaK Coolant Cell +ComponentName.CoolantCell360kSpace=360k Space Coolant Cell +ComponentName.CoolantCell540kSpace=540k Space Coolant Cell +ComponentName.CoolantCell60k=60k Coolant Cell +ComponentName.CoolantCell60kHelium=60k He Coolant Cell +ComponentName.CoolantCell60kNak=60k NaK Coolant Cell +ComponentName.DualFuelRodCesium=Dual Fuel Rod (Cesium) +ComponentName.DualFuelRodCoaxium=Dual Fuel Rod (Coaxium) +ComponentName.DualFuelRodMox=Dual Fuel Rod (MOX) +ComponentName.DualFuelRodNaquadah=Dual Fuel Rod (Naquadah) +ComponentName.DualFuelRodNaquadahGTNH=Dual Fuel Rod (Naquadah) +ComponentName.DualFuelRodNaquadria=Dual Fuel Rod (Naquadria) +ComponentName.DualFuelRodThorium=Dual Fuel Rod (Thorium) +ComponentName.DualFuelRodTiberium=Dual Fuel Rod (Tiberium) +ComponentName.DualFuelRodUranium=Dual Fuel Rod (Uranium) +ComponentName.FuelRodCesium=Fuel Rod (Cesium) +ComponentName.FuelRodCoaxium=Fuel Rod (Coaxium) +ComponentName.FuelRodMox=Fuel Rod (MOX) +ComponentName.FuelRodNaquadah=Fuel Rod (Naquadah) +ComponentName.FuelRodNaquadahGTNH=Fuel Rod (Naquadah) +ComponentName.FuelRodNaquadria=Fuel Rod (Naquadria) +ComponentName.FuelRodTheCore=Fuel Rod (The Core) +ComponentName.FuelRodThorium=Fuel Rod (Thorium) +ComponentName.FuelRodTiberium=Fuel Rod (Tiberium) +ComponentName.FuelRodUranium=Fuel Rod (Uranium) +ComponentName.HeatCapacityReactorPlating=Heat-Capacity Reactor Plating +ComponentName.HeatExchanger=Heat Exchanger +ComponentName.HeatVent=Heat Vent +ComponentName.IridiumNeutronReflector=Iridium Neutron Reflector +ComponentName.LzhCondensator=LZH-Condensator +ComponentName.NeutronReflector=Neutron Reflector +ComponentName.OverclockedHeatVent=Overclocked Heat Vent +ComponentName.QuadFuelRodCesium=Quad Fuel Rod (Cesium) +ComponentName.QuadFuelRodCoaxium=Quad Fuel Rod (Coaxium) +ComponentName.QuadFuelRodMox=Quad Fuel Rod (MOX) +ComponentName.QuadFuelRodNaquadah=Quad Fuel Rod (Naquadah) +ComponentName.QuadFuelRodNaquadahGTNH=Quad Fuel Rod (Naquadah) +ComponentName.QuadFuelRodNaquadria=Quad Fuel Rod (Naquadria) +ComponentName.QuadFuelRodThorium=Quad Fuel Rod (Thorium) +ComponentName.QuadFuelRodTiberium=Quad Fuel Rod (Tiberium) +ComponentName.QuadFuelRodUranium=Quad Fuel Rod (Uranium) +ComponentName.ReactorHeatExchanger=Reactor Heat Exchanger +ComponentName.ReactorHeatVent=Reactor Heat Vent +ComponentName.ReactorPlating=Reactor Plating +ComponentName.RshCondensator=RSH-Condensator +ComponentName.ThickNeutronReflector=Thick Neutron Reflector + +ComponentTooltip.Broken=Broke during last simulation +ComponentTooltip.ResidualHeat=Had residual heat after last simulation + +Config.CSVCheckbox=Output CSV Data +Config.CSVLimit=For how many simulated seconds: +Config.EUReactor=EU Reactor +Config.FluidReactor=Fluid Reactor +Config.InitialComponentHeat=Initial Heat: +Config.NoComponentSelected=No component selected +Config.OffPulse=Off-pulse duration: +Config.OnPulse=On-pulse duration: +Config.PlacingReactorPause=Reactor Pause: +Config.PlacingReplacementThreshold=Threshold: +Config.PulseHelp=(on-pulse can be set to 5 million to mimic having no redstone timing) +Config.ReactorCoolantInjectors=Use Reactor Coolant Injectors (MC 1.8+ only) +Config.ReactorPause=Reactor Pause (seconds): +Config.ReactorPauseHelp=(This is how long the reactor will pause while replacing this component) +Config.ReplacementThreshold=Replacement Threshold: +Config.ReplacementThresholdHelp=(Set higher than component's initial heat/damage to replace the component when it gets this hot/damaged, or lower to replace a component that has cooled; broken components will be replaced during automation runs regardless of this setting) +Config.ResumeTemp=Resume when reactor temp <= +# Same language string should be usable anywhere "seconds" appears. +Config.Seconds=seconds +Config.SimulationStyle=Simulation Style: +Config.SuspendTemp=Suspend when reactor temp >= +Config.SuspendTempHelp=(both temps can be set to match explode temp to mimic having no temperature control) + +CSVData.EntryComponentValue=,"%.2f" +CSVData.EntryComponentOutput=,%.0f +CSVData.EntryCoreHeat=,%.0f +CSVData.EntryEUOutput=,"%.2f" +CSVData.EntryHUOutput=,%.0f +CSVData.EntryReactorTick=%d +CSVData.HeaderComponentName=,%s (R%dC%d) +CSVData.HeaderComponentOutput=,%s (R%dC%d) Output +CSVData.HeaderCoreHeat=,Core Heat +CSVData.HeaderEUOutput=,EU Output +CSVData.HeaderHUOutput=,HU Output +CSVData.HeaderReactorTick=Reactor Time + +MaterialName.AdvancedAlloy=Advanced Alloy +MaterialName.AdvancedCircuit=Advanced Circuit +MaterialName.Aluminium=Aluminium +MaterialName.BasicCircuit=Basic Circuit +MaterialName.Beryllium=Beryllium +MaterialName.Bronze=Bronze +MaterialName.CallistoIceDust=Callisto Ice Dust +MaterialName.CesiumFuel=Cesium-Enriched Nuclear Fuel +MaterialName.Coal=Coal +MaterialName.CoaxiumFuel=Coaxium-Enriched Nuclear Fuel +MaterialName.Copper=Copper +MaterialName.Diamond=Diamond +MaterialName.DistilledWater=Distilled Water +MaterialName.EmptyCell=Empty Cell +MaterialName.EnrichedNaquadah=Enriched Naquadah +MaterialName.FluxedElectrum=Fluxed Electrum +MaterialName.Glass=Glass +MaterialName.GlowstoneDust=Glowstone Dust +MaterialName.Gold=Gold +MaterialName.Graphite=Graphite +MaterialName.Helium==Helium +MaterialName.Iridium=Iridium +MaterialName.IridiumReinforcedPlate=Iridium Reinforced Plate +MaterialName.Iron=Iron +MaterialName.LapisLazuli=Lapis Lazuli +MaterialName.Lead=Lead +MaterialName.LedoxDust=Ledox Dust +MaterialName.MoxFuel=MOX Fuel +MaterialName.Naquadria=Naquadria +MaterialName.Platinum=Platinum +MaterialName.Potassium=Potassium +MaterialName.Redstone=Redstone +MaterialName.ReinforcedGlass=Reinforced Glass +MaterialName.Rubber=Rubber +MaterialName.Sodium=Sodium +MaterialName.Thorium=Thorium +MaterialName.Tiberium=Tiberium +MaterialName.Tungsten=Tungsten +MaterialName.Tin=Tin +MaterialName.UraniumFuel=Uranium Fuel + +# %s at the end of this string is for optionally showing the range of active time. +Simulation.ActiveTime=Reactor was active for a total of %,d seconds%s.\n +Simulation.ActiveTimeRange=\u0020(%,d to %,d seconds at a time) +Simulation.ActiveTimeSingle=\u0020(%,d seconds at a time) +Simulation.CancelledAtTick=Simulation cancelled after simulating %,d seconds.\n +Simulation.ComponentHeating=Component heating: %.2f average.\n +Simulation.ComponentsReplaced=Components replaced:\n%s +Simulation.CSVOpenFailure=Failed to open CSV file for output.\n +Simulation.CycleCompleteTime=Cycle complete after %,d seconds.\n +# This will be used to optionally show extra precision, in format strings where %s is used when %.2f might otherwise be expected. +Simulation.DecimalFormat=#,##0.## +Simulation.Efficiency=Efficiency: %.2f average, %.2f minimum, %.2f maximum\n +Simulation.ElapsedTime=Simulation took %.2f seconds.\n +Simulation.ErrorCooldown=Error %,d simulated seconds into cooldown.\n +Simulation.ErrorReactor=Error after simulating %d seconds of reactor activity\n +Simulation.EUOutputs=Total output after full simulation: %s EU (%s EU/t average, %s EU/t min, %s EU/t max)\n +Simulation.EUOutputsBeforeDepleted=Total output before first fuel rod depleted: %s EU (%s EU/t average, %s EU/t min, %s EU/t max)\n +Simulation.EUOutputsBeforeBreak=Total output before first component broken: %s EU (%s EU/t average, %s EU/t min, %s EU/t max)\n +Simulation.ExcessCooling=Excess cooling: %.2f\n +Simulation.ExcessHeating=Excess heating: %.2f\n +Simulation.ExplosionPower=Raw explosion power: %,.2f\n +Simulation.FirstComponentBrokenDetails=First Component Broken: %s at row %d column %d, at %d seconds.\n +Simulation.FirstRodDepletedDetails=First Fuel Rod Depleted: %s at row %d column %d, at %d seconds.\n +Simulation.FuelRodsTime=Fuel rods (if any) stopped after %,d seconds.\n +Simulation.HeatOutputs=Total output after full simulation: %s HU (%s HU/t average, %s HU/t minimum, %s HU/t max)\n +Simulation.HeatOutputsBeforeBreak=Total output before first component broken: %s HU (%s HU/t average, %s HU/t minimum, %s HU/t max)\n +Simulation.HeatOutputsBeforeDepleted=Total output before first fuel rod depleted: %s HU (%s HU/t average, %s HU/t minimum, %s HU/t max)\n +Simulation.HullCooling=Hull cooling: %,.2f average of %,.0f possible.\n +Simulation.HullHeating=Hull heating: %,.2f average.\n +Simulation.InactiveTime=Reactor was inactive for a total of %,d seconds%s.\n +Simulation.InactiveTimeRange=\u0020(%,d to %,d seconds at a time) +Simulation.InactiveTimeSingle=\u0020(%,d seconds at a time) +Simulation.LapisUsed=Used %d Lapis Lazuli Blocks.\n +Simulation.MaxHeatGenerated=Max heat generated (internally, by fuel rods): %,.0f\n +Simulation.NoCooldown=No cooldown needed.\n +Simulation.NoFuelRods=No fuel rods found! Simulating a pulsed cycle makes no sense! +Simulation.ReactorCooldownTime=Reactor took %,d seconds to cool down.\n +Simulation.ReactorHeatBuildup=Reactor heat buildup per second (while all components are intact):%,.0f minimum, %,.0f maximum.\n +Simulation.ReactorMaxTemp=Reactor maximum temperature: %,.0f\n +Simulation.ReactorMaxTempBeforeDepleted=Reactor maximum temperature (before first fuel rod depleted): %,.0f\n +Simulation.ReactorMinTemp=Reactor minimum temperature: %,.0f\n +Simulation.ReactorMinTempBeforeDepleted=Reactor minimum temperature (before first fuel rod depleted): %,.0f\n +Simulation.ReactorOverheatedTime=Reactor overheated at %,d seconds.\n +Simulation.ReactorRemainingHeat=Reactor remained at %,.0f heat after main simulation finished.\n +Simulation.ReactorResidualHeat=Reactor remained at %,.0f heat even after cool down period of %,d seconds.\n +Simulation.RedstoneUsed=Used %d Blocks of Redstone.\n +Simulation.Started=Simulation started.\n +Simulation.TimeToBelow50=Reactor will dip below 50%% heat for the first time (after being above it) at %d seconds.\n +Simulation.TimeToBurn=Reactor will reach "Burn" temperature at %d seconds.\n +Simulation.TimeToEvaporate=Reactor will reach "Evaporate" temperature at %d seconds.\n +Simulation.TimeToHurt=Reactor will reach "Hurt" temperature at %d seconds.\n +Simulation.TimeToLava=Reactor will reach "Lava" temperature at %d seconds.\n +# Note: The "e" is deliberately dropped from "Explode" in the key name so that it will sort after the others. +Simulation.TimeToXplode=Reactor will explode at %d seconds.\n +Simulation.TimeWithoutExploding=\nReactor ran for %,d seconds without exploding.\n +Simulation.TotalCellCooling=Total Cell Cooling (peak usages): %,.2f\n +Simulation.TotalCondensatorCooling=Total Condensator Cooling (peak usages): %,.2f\n +Simulation.TotalCooldownTime=Other components took %,d seconds to cool down (as much as they would).\n +Simulation.TotalVentCooling=Total Vent Cooling (peak usages, theoretical maximum): %,.2f of %,.2f\n +Simulation.VentCooling=Vent cooling: %,.2f average of %,.0f possible.\n + +UI.AdvancedTab=Advanced +#Needs to be heavily abbreviated to fit on the button. +UI.AutomateButton=a +UI.AutomateButtonFont=Arial 10 +UI.AutomatedReactor=Automated Reactor +UI.AutomatedReactorTooltip=Turn on to allow automating of adding/removing of components. +UI.AutomationTooltip=Click to define automation rules for this component. +UI.CancelButton=Cancel +UI.ChosenComponentRowCol=%s at row %d column %d +UI.ClearGridButton=Clear Grid +UI.CodeLabel=Code: +UI.ComparisonTab=Comparison +UI.ComponentAutomationTab=Component Automation +#Needs to be heavily abbreviated to fit on the button. +UI.ComponentInfoButton=i +UI.ComponentInfoButtonFont=Arial 10 +UI.ComponentInfoButtonTooltip=Click for information about this component +UI.ComponentInfoDefault=Please run a simulation and select a component in the reactor grid above to see its details. +UI.ComponentInfoLastSimRowCol=%s at row %d column %d\n%s +UI.ComponentListTab=Component List +UI.ComponentPlacingDefault=Placing Component: None +UI.ComponentPlacingSpecific=Placing Component: %s +UI.ComponentTab=Component +UI.CopyCodeButton=Copy Code +UI.CopyComparisonData=Copy Comparison Data +UI.CSVBrowseButton=Browse +UI.CSVFileDefault=No File Selected +UI.CSVHelp=Warnings:
  1. Simulation will likely run much slower with CSV Output enabled, especially if the chosen file is on a mechanical hard drive.
  2. User is responsible for making sure target drive has enough space for the CSV file.
  3. Additional simulations will overwrite the CSV file unless the target is manually changed.
+UI.CSVTab=CSV +UI.EnableGT508Components=Enable GT 5.08 Components +UI.EnableGT509Components=Enable GT 5.09 Components +UI.ExpandAdvancedAlloy=Expand Advanced Alloy into constituent materials (invalid when using GregTech) +UI.GregTechVersion=GregTech Version: +UI.GregTechVersionNone=None +UI.GTReactorBehavior=GT 5.09 = (2x base EU). GTNH = (10x base EU, Naq Rods->not-MOX-like). Setting always applies to -only fuel rods regardless. +UI.InitialHeatDisplay=\u0020(initial heat: %,d) +UI.InitialReactorHeat=Initial Reactor Heat: +UI.InitialReactorHeatTooltip=Use this to set a heat value for testing MOX-like reactors. +UI.LockInTabCode=Lock in-tab code +UI.MainTitle=IC2 Experimental Reactor Planner +UI.MaterialDecimalFormat=#,##0.## +UI.MaterialsTab=Materials +UI.MaxHeatDefault=/10,000 +UI.MaxHeatSpecific=/%,.0f +UI.MaxSimulationTicks=Maximum time to simulate: +UI.MaxSimulationTicksTooltip=Forces simulation to stop after simulating this much time, even if reactor hasn't exploded or ceased outputting HU or EU. +UI.MinecraftVersion=Minecraft Version: +UI.NoComponentLastSimRowCol=No component at row %d column %d during last simulation. +UI.NoComponentRowCol=No component at row %d column %d. +UI.NoSimulationRun=No simulation run yet. +UI.OnlyShowDiffData=Only show data that is significantly different +UI.PasteCodeButton=Paste Code +UI.PulseConfigurationTab=Pulse Configuration +UI.PulsedReactor=Pulsed Reactor +UI.RemoveAddonComponentsTitle=Add-on Components Found +UI.RemoveGT508ComponentsText=GT 5.08 components found in current design. Remove them? +UI.RemoveGT509ComponentsText=GT 5.09 components found in current design. Remove them? +UI.ResetPulseConfig=Reset Pulse Configuration +UI.ShowComponentDetailButtons=Show Component Detail Buttons +UI.ShowComponentPreconfigControls=Show Component Pre-configuration Controls +UI.ShowOldStyleReactorCode=Show old-style (pre-2.3.1) reactor code +UI.SimulateButton=Simulate +UI.SimulationTab=Simulation +UI.SimulationTypeAutomation=Pulsed Automation +UI.SimulationTypePulsed=Pulsed Cycle +UI.SimulationTypeSimple=Simple Cycle +UI.TemperatureEffectsDefault=Burn: 4,000 Evaporate: 5,000 Hurt: 7,000 Lava: 8,500 Explode: 10,000 +UI.TemperatureEffectsSpecific=Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d +UI.TexturePackBrowseButton=Browse +UI.TexturePackClearButton=Clear +UI.TexturePackDefault=Texture Pack: no file selected +UI.TexturePackHelp=(restart planner to see new textures) +UI.TexturePackSpecific=Texture Pack: %s +UI.UseGTRecipes=Use GregTech recipes for component materials (where applicable and unambiguous) +UI.UseUfcForCoolantCells=Use Universal Fluid Cells for coolant (incompatible with GregTech recipes option) +UI.VersionNumber=Version %s + +Warning.DepletedIsotope=Obsolete component (depleted isotope cell) at row %d column %d removed.\n +Warning.DualPlutonium=Obsolete component (dual plutonium cell) at row %d column %d removed.\n +Warning.Heating=Obsolete component (heating cell) at row %d column %d removed.\n +Warning.InvalidReactorCode=Invalid Reactor Code: %s +Warning.Plutonium=Obsolete component (plutonium cell) at row %d column %d removed.\n +Warning.QuadPlutonium=Obsolete component (quad plutonium cell) at row %d column %d removed.\n +Warning.Title=Warning(s) +Warning.Unrecognized=Unrecognized component (id %d) at row %d column %d removed.\n diff --git a/src/main/java/Ic2ExpReactorPlanner/BundleHelper.java b/src/main/java/Ic2ExpReactorPlanner/BundleHelper.java new file mode 100644 index 0000000000..8bbc9aab45 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/BundleHelper.java @@ -0,0 +1,43 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner; + +import java.util.ResourceBundle; + +/** + * Utility class to handle handle access to the planner's resource bundle. + * Methods may be static-imported, and hopefully this will make the code more + * concise, but not to the point of obfuscation. + * @author Brian McCloud + */ +public class BundleHelper { + + private BundleHelper() { + // private no-op constructor to prevent instantiation. + } + + private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("Ic2ExpReactorPlanner/Bundle"); + + /** + * Looks up a key in the planner's resource bundle. + * @param key the key to look up in the resource bundle. + * @return the value from the resource bundle for the default locale of the system the planner is being run on. + */ + public static String getI18n(String key) { + return BUNDLE.getString(key); + } + + /** + * Uses a resource bundle entry as a format specifier. + * @param key the key to look up in the resource bundle. + * @param args the arguments to use in String.format. + * @return the formatted string. + */ + public static String formatI18n(String key, Object... args) { + return String.format(getI18n(key), args); + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/Bundle_zh_CN.properties b/src/main/java/Ic2ExpReactorPlanner/Bundle_zh_CN.properties new file mode 100644 index 0000000000..b3d5076fb2 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/Bundle_zh_CN.properties @@ -0,0 +1,373 @@ + +# Comparison keys are for comparing two simulated reactors. Instead of being in +# in a TextArea like the main simulation, the comparison will be in a JLabel, wrapped +# in html tags, to allow color coding of the text more easily. + +Comparison.CompareDecimalFormat=+#,##0.##;-# +Comparison.ComponentHeating=\u5143\u4ef6\u4ea7\u70ed: %s (%s/%s)
+Comparison.ComponentsHeading=\u5143\u4ef6:
+Comparison.ComponentsReplacedHeading=\u66f4\u6362\u5143\u4ef6:
+Comparison.Default=\u8bf7\u81f3\u5c11\u8fd0\u884c\u4e24\u6b21\u6a21\u62df (\u6700\u597d\u4f7f\u7528\u4e0d\u540c\u7684\u53cd\u5e94\u5806\u8bbe\u8ba1) \u4ee5\u8fdb\u884c\u6bd4\u8f83. +Comparison.EUEUoutput=\u603b\u4ea7\u80fd: %s (%s/%s) EU (\u5e73\u5747: %s EU/t (%s/%s), \u6700\u5c0f: %s EU/t (%s/%s), \u6700\u5927: %s EU/t (%s/%s))
+Comparison.EUHUoutput=\u603b\u4ea7\u80fd/\u4ea7\u70ed: %s EU / %s HU (\u5e73\u5747: %s EU/t / %s HU/t, \u6700\u5c0f: %s EU/t / %s HU/t, \u6700\u5927: %s EU/t / %s HU/t)
+Comparison.Header=\u8fd9\u4e00\u6b21\u6a21\u62df (\u5de6\u4fa7, \u4e3b\u4ee3\u7801) \u4e0e\u4e0a\u4e00\u6b21\u6a21\u62df (\u53f3\u4fa7, \u6807\u7b7e\u5185\u4ee3\u7801) \u76f8\u6bd4\u8f83: +Comparison.HUEUoutput=\u603b\u4ea7\u70ed/\u4ea7\u80fd: %s HU / %s EU (\u5e73\u5747: %s HU/t / %s EU/t, \u6700\u5c0f: %s HU/t / %s EU/t, \u6700\u5927: %s HU/t / %s EU/t)
+Comparison.HUHUoutput=\u603b\u4ea7\u70ed: %s (%s/%s) HU (\u5e73\u5747: %s HU/t (%s/%s), \u6700\u5c0f: %s HU/t (%s/%s), \u6700\u5927: %s HU/t (%s/%s))
+Comparison.HullCooling=\u5916\u58f3\u51b7\u5374: %s (%s/%s)
+Comparison.HullCoolingPossible=\u53ef\u80fd\u7684\u5916\u58f3\u51b7\u5374: %s (%s/%s)
+Comparison.HullHeating=\u5916\u58f3\u4ea7\u70ed: %s (%s/%s)
+Comparison.MaterialsEntry=%s %s (%s/%s)
+Comparison.MaterialsHeading=\u6750\u6599:
+Comparison.NoDifferences=\u672a\u68c0\u6d4b\u5230\u660e\u663e\u5dee\u5f02. +Comparison.PostsimMaxTemp=\u53cd\u5e94\u5806\u6700\u9ad8\u6e29\u5ea6: %s (%s/%s)
+Comparison.PostsimMinTemp=\u53cd\u5e94\u5806\u6700\u4f4e\u6e29\u5ea6: %s (%s/%s)
+Comparison.PredepleteMaxTemp=\u53cd\u5e94\u5806\u6700\u9ad8\u6e29\u5ea6 (\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d): %s (%s/%s)
+Comparison.PredepleteMinTemp=\u53cd\u5e94\u5806\u6700\u4f4e\u6e29\u5ea6 (\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d): %s (%s/%s)
+Comparison.Prefix.PostSimulation=\u6a21\u62df\u540e,\u0020 +Comparison.Prefix.PostSimulationTime=\u6a21\u62df\u65f6\u95f4:\u0020 +Comparison.Prefix.Prebreak=\u5728\u7b2c\u4e00\u4e2a\u5143\u4ef6\u635f\u574f\u4e4b\u524d,\u0020 +Comparison.Prefix.PrebreakTime=\u7b2c\u4e00\u6b21\u5143\u4ef6\u635f\u574f\u7684\u65f6\u95f4:\u0020 +Comparison.Prefix.Predeplete=\u5728\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d,\u0020 +Comparison.Prefix.PredepleteTime=\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u65f6\u95f4:\u0020 +Comparison.Prefix.TimeToBelow50=\u8fbe\u5230\u70ed\u91cf\u964d\u81f3 50%% \u4ee5\u4e0b\u7684\u65f6\u95f4 (\u5728\u9ad8\u4e8e 50%% \u4e4b\u540e):\u0020 +Comparison.Prefix.TimeToBurn=\u8fbe\u5230 "\u71c3\u70e7" \u6e29\u5ea6\u7684\u65f6\u95f4:\u0020 +Comparison.Prefix.TimeToEvaporate=\u8fbe\u5230 "\u84b8\u53d1" \u6e29\u5ea6\u7684\u65f6\u95f4:\u0020 +Comparison.Prefix.TimeToHurt=\u8fbe\u5230 "\u4f24\u5bb3" \u6e29\u5ea6\u7684\u65f6\u95f4:\u0020 +Comparison.Prefix.TimeToLava=\u8fbe\u5230 "\u7194\u5316" \u6e29\u5ea6\u7684\u65f6\u95f4:\u0020 +Comparison.Prefix.TimeToXplode=\u8fbe\u5230\u7206\u70b8\u7684\u65f6\u95f4:\u0020 +Comparison.SimpleDecimalFormat=#,##0.## +Comparison.Time.Both=%+,d \u79d2 (%d/%d)
+Comparison.Time.BothColored=%+,d \u79d2 (%d/%d)
+Comparison.Time.LeftOnly=%d/\u221e
+Comparison.Time.RightOnly=\u221e/%d
+Comparison.VentCooling=\u6563\u70ed\u7247\u51b7\u5374: %s (%s/%s)
+Comparison.VentCoolingPossible=\u53ef\u80fd\u7684\u6563\u70ed\u7247\u51b7\u5374: %s (%s/%s)
+ +# ComponentData keys are for providing extra details in the tooltips for the component palette. +# Suggested by kekzdealer in Pull Request: https://github.com/MauveCloud/Ic2ExpReactorPlanner/pull/67 +# but heavily modified since. + +ComponentData.AdvancedHeatExchanger=\u70ed\u5bb9\u91cf: 10,000
\u53cd\u5e94\u5806\u70ed\u4ea4\u6362\u7387: 8 heat/s
\u5143\u4ef6\u70ed\u4ea4\u6362\u7387: 24 heat/s +ComponentData.AdvancedHeatVent=\u70ed\u5bb9\u91cf: 1,000
\u81ea\u6563\u70ed\u7387: 12 heat/s +ComponentData.ComponentHeatExchanger=\u70ed\u5bb9\u91cf: 5,000
\u5143\u4ef6\u70ed\u4ea4\u6362\u7387: 36 heat/s +ComponentData.ComponentHeatVent=\u5143\u4ef6\u51b7\u5374\u901f\u5ea6: 4 heat/s +ComponentData.ContainmentReactorPlating=\u964d\u4f4e\u7206\u70b8\u8303\u56f4 +ComponentData.CoolantCell10k=\u70ed\u5bb9\u91cf: 10,000 +ComponentData.CoolantCell180kHelium=\u70ed\u5bb9\u91cf: 180,000 +ComponentData.CoolantCell180kNak=\u70ed\u5bb9\u91cf: 180,000 +ComponentData.CoolantCell30k=\u70ed\u5bb9\u91cf: 30,000 +ComponentData.CoolantCell360kHelium=\u70ed\u5bb9\u91cf: 360,000 +ComponentData.CoolantCell360kNak=\u70ed\u5bb9\u91cf: 360,000 +ComponentData.CoolantCell60k=\u70ed\u5bb9\u91cf: 60,000 +ComponentData.CoolantCell60kHelium=\u70ed\u5bb9\u91cf: 60,000 +ComponentData.CoolantCell60kNak=\u70ed\u5bb9\u91cf: 60,000 +ComponentData.DualFuelRodCesium=\u6301\u7eed\u65f6\u95f4: 10,861 \u79d2
\u4ea7\u51fa EU: 40/60/80/100/120
\u4ea7\u751f\u70ed\u91cf: 6/12/20/30/42 +ComponentData.DualFuelRodCoaxium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 20/30/40/50/60
\u4ea7\u751f\u70ed\u91cf: 0 +ComponentData.DualFuelRodMox=\u6301\u7eed\u65f6\u95f4: 10,000 \u79d2
\u4ea7\u51fa EU: [20,100)/[30,150)/[40,200)/[50,250)/[60,300) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 24/48/80/120/168
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 48/96/160/240/336 +ComponentData.DualFuelRodNaquadah=\u6301\u7eed\u65f6\u95f4: 100,000 \u79d2
\u4ea7\u51fa EU: [40,100)/[60,150)/[80,200)/[100,250)/[120,300) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 24/48/80/120/168
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 48/96/160/240/336 +ComponentData.DualFuelRodThorium=\u6301\u7eed\u65f6\u95f4: 50,000 \u79d2
\u4ea7\u51fa EU: 4/6/8/10/12
\u70ed\u91cf\u4ea7\u751f: 6/12/20/30/42 +ComponentData.DualFuelRodUranium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 20/30/40/50/60
\u4ea7\u751f\u70ed\u91cf: 24/48/80/120/168 +ComponentData.FuelRodCesium=\u6301\u7eed\u65f6\u95f4: 10,861 \u79d2
\u4ea7\u51fa EU: 10/20/30/40/50
\u4ea7\u751f\u70ed\u91cf: 1/3/8/10/15 +ComponentData.FuelRodCoaxium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 5/10/15/20/25
\u4ea7\u751f\u70ed\u91cf: 0 +ComponentData.FuelRodMox=\u6301\u7eed\u65f6\u95f4: 10,000 \u79d2
\u4ea7\u51fa EU: [5,25)/[10,50)/[15,75)/[20,100)/[25,125) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 4/12/24/40/60
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 8/24/48/80/120 +ComponentData.FuelRodNaquadah=\u6301\u7eed\u65f6\u95f4: 100,000 \u79d2
\u4ea7\u51fa EU: [10,25)/[20,50)/[30,75)/[40,100)/[50,125) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 4/12/24/40/60
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 8/24/48/80/120 +ComponentData.FuelRodThorium=\u6301\u7eed\u65f6\u95f4: 50,000 \u79d2
\u4ea7\u51fa EU: 1/2/3/4/5
\u4ea7\u751f\u70ed\u91cf: 1/3/8/10/15 +ComponentData.FuelRodUranium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 5/10/15/20/25
\u4ea7\u751f\u70ed\u91cf: 4/12/24/40/60 +ComponentData.HeatCapacityReactorPlating=\u589e\u52a0\u6700\u5927\u70ed\u5bb9\u91cf +ComponentData.HeatExchanger=\u70ed\u5bb9\u91cf: 2,500
\u53cd\u5e94\u5806\u70ed\u4ea4\u6362\u7387: 4 heat/s
\u5143\u4ef6\u70ed\u4ea4\u6362\u7387: 12 heat/s +ComponentData.HeatVent=\u70ed\u5bb9\u91cf: 1,000
\u81ea\u6563\u70ed\u7387: 6 heat/s +ComponentData.IridiumNeutronReflector=\u8010\u4e45: \u65e0\u9650 +ComponentData.LzhCondensator=\u70ed\u5bb9\u91cf: 100,000
\u65e0\u6cd5\u88ab\u6563\u70ed\u7247\u51b7\u5374. +ComponentData.NeutronReflector=\u8010\u4e45: 30,000 (MC 1.7.10 \u4e2d\u4e3a 10,000) +ComponentData.OverclockedHeatVent=\u70ed\u5bb9\u91cf: 1,000
\u81ea\u6563\u70ed\u7387: 20 heat/s
\u51b7\u5374\u901f\u5ea6: 36 heat/s +ComponentData.QuadFuelRodCesium=\u6301\u7eed\u65f6\u95f4: 10,861 \u79d2
\u4ea7\u51fa EU: 120/160/200/240/280
\u4ea7\u751f\u70ed\u91cf: 24/40/60/84/112 +ComponentData.QuadFuelRodCoaxium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 60/80/100/120/140
\u4ea7\u751f\u70ed\u91cf: 0 +ComponentData.QuadFuelRodMox=\u6301\u7eed\u65f6\u95f4: 10,000 \u79d2
\u4ea7\u51fa EU: [60,300)/[80,400)/[100,500)/[120,600)/[140,700) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 96/160/240/336/448
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 192/320/480/672/896 +ComponentData.QuadFuelRodNaquadah=\u6301\u7eed\u65f6\u95f4: 100,000 \u79d2
\u4ea7\u51fa EU: [120,300)/[160,400)/[200,500)/[240,600)/[280,700) - \u4e0e\u53cd\u5e94\u5806\u6e29\u5ea6\u6210\u7ebf\u6027\u6bd4\u4f8b.
EU \u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6<=50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 96/160/240/336/448
\u6d41\u4f53\u53cd\u5e94\u5806\u6a21\u5f0f\u4e0b, \u5f53\u5916\u58f3\u6e29\u5ea6>50%\u65f6\u7684\u4ea7\u70ed\u6548\u7387: 192/320/480/672/896 +ComponentData.QuadFuelRodThorium=\u6301\u7eed\u65f6\u95f4: 50,000 \u79d2
\u4ea7\u51fa EU: 12/16/20/24/28
\u4ea7\u751f\u70ed\u91cf: 24/40/60/84/112 +ComponentData.QuadFuelRodUranium=\u6301\u7eed\u65f6\u95f4: 20,000 \u79d2
\u4ea7\u51fa EU: 60/80/100/120/140
\u4ea7\u751f\u70ed\u91cf: 96/160/240/336/448 +ComponentData.ReactorHeatExchanger=\u70ed\u5bb9\u91cf: 5,000
\u53cd\u5e94\u5806\u70ed\u4ea4\u6362\u7387: 72 heat/s +ComponentData.ReactorHeatVent=\u70ed\u5bb9\u91cf: 1,000
\u81ea\u6563\u70ed\u7387: 5 heat/s
\u51b7\u5374\u901f\u5ea6: 5 heat/s +ComponentData.ReactorPlating=\u5bc6\u5c01\u53cd\u5e94\u5806\u9694\u70ed\u677f\u4e0e\u9ad8\u70ed\u5bb9\u53cd\u5e94\u5806\u9694\u677f\u7684\u5408\u6210\u6750\u6599 +ComponentData.RshCondensator=\u70ed\u5bb9\u91cf: 20,000
\u65e0\u6cd5\u88ab\u6563\u70ed\u7247\u51b7\u5374. +ComponentData.ThickNeutronReflector=\u8010\u4e45: 120,000 (MC 1.7.10 \u4e2d\u4e3a 40,000) + +# ComponentInfo keys are for updating information about a component during a simulation. + +ComponentInfo.BrokeTime=\n %,d \u79d2\u540e\u635f\u574f. +ComponentInfo.CooldownTime=\n\u51b7\u5374\u4e86 %,d \u79d2. +ComponentInfo.GeneratedEU=\n\u4ea7\u751f %,.2f \u4e8e %,.2f EU/\u79d2. +ComponentInfo.GeneratedHeat=\n\u4ea7\u751f %,.0f \u4e8e %,.0f \u70ed\u91cf/\u79d2. +ComponentInfo.ReachedHeat=\n\u4ea7\u751f %,.0f \u4e8e %,.0f \u70ed\u91cf. +ComponentInfo.ReceivedHeat=\n\u6700\u591a\u4ea7\u751f %,.0f \u70ed\u91cf/\u79d2 +ComponentInfo.RemainingHeat=\n\u6a21\u62df\u505c\u6b62\u540e, \u8fd8\u5269\u4f59 %,.0f \u70ed\u91cf. +ComponentInfo.ReplacedTime=\n \u5728 %,d \u79d2\u540e\u88ab\u66ff\u6362. +ComponentInfo.ResidualHeat=\n\u51b7\u5374\u540e\u8fd8\u6709 %,.0f \u70ed\u91cf. +ComponentInfo.UsedCooling=\n\u4f7f\u7528 %,.0f \u4e8e %,.0f \u51b7\u5374. + + +# Keys for component names were originally matched to class names, to allow using reflection to look them up. +# However, refactoring eliminated the "one class for each component type" idea. +# These keys will be used both in the reactor area and the component selection area. + +ComponentName.AdvancedHeatExchanger=\u9ad8\u7ea7\u70ed\u4ea4\u6362\u5668 +ComponentName.AdvancedHeatVent=\u9ad8\u7ea7\u6563\u70ed\u7247 +ComponentName.ComponentHeatExchanger=\u5143\u4ef6\u70ed\u4ea4\u6362\u5668 +ComponentName.ComponentHeatVent=\u5143\u4ef6\u6563\u70ed\u7247 +ComponentName.ContainmentReactorPlating=\u5bc6\u5c01\u53cd\u5e94\u5806\u9694\u70ed\u677f +ComponentName.CoolantCell10k=10k \u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell180kHelium=180k \u6c26\u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell180kNak=180k \u94a0\u94be\u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell30k=30k \u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell360kHelium=360k \u6c26\u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell360kNak=360k \u94a0\u94be\u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell60k=60k \u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell60kHelium=60k \u6c26\u51b7\u5374\u5355\u5143 +ComponentName.CoolantCell60kNak=60k \u94a0\u94be\u51b7\u5374\u5355\u5143 +ComponentName.DualFuelRodCesium=\u53cc\u8054\u71c3\u6599\u68d2 (\u94ef) +ComponentName.DualFuelRodCoaxium=\u53cc\u8054\u71c3\u6599\u68d2 (Coaxium) +ComponentName.DualFuelRodMox=\u53cc\u8054\u71c3\u6599\u68d2 (MOX) +ComponentName.DualFuelRodNaquadah=\u53cc\u8054\u71c3\u6599\u68d2 (\u7845\u5ca9) +ComponentName.DualFuelRodThorium=\u53cc\u8054\u71c3\u6599\u68d2 (\u948d) +ComponentName.DualFuelRodUranium=\u53cc\u8054\u71c3\u6599\u68d2 (\u94c0) +ComponentName.FuelRodCesium=\u71c3\u6599\u68d2 (\u94ef) +ComponentName.FuelRodCoaxium=\u71c3\u6599\u68d2 (Coaxium) +ComponentName.FuelRodMox=\u71c3\u6599\u68d2 (MOX) +ComponentName.FuelRodNaquadah=\u71c3\u6599\u68d2 (\u7845\u5ca9) +ComponentName.FuelRodThorium=\u71c3\u6599\u68d2 (\u948d) +ComponentName.FuelRodUranium=\u71c3\u6599\u68d2 (\u94c0) +ComponentName.HeatCapacityReactorPlating=\u9ad8\u70ed\u5bb9\u53cd\u5e94\u5806\u9694\u677f +ComponentName.HeatExchanger=\u70ed\u4ea4\u6362\u5668 +ComponentName.HeatVent=\u6563\u70ed\u7247 +ComponentName.IridiumNeutronReflector=\u94f1\u4e2d\u5b50\u53cd\u5c04\u677f +ComponentName.LzhCondensator=\u9752\u91d1\u77f3\u51b7\u51dd\u6a21\u5757 +ComponentName.NeutronReflector=\u4e2d\u5b50\u53cd\u5c04\u677f +ComponentName.OverclockedHeatVent=\u8d85\u9891\u6563\u70ed\u7247 +ComponentName.QuadFuelRodCesium=\u56db\u8054\u71c3\u6599\u68d2 (\u94ef) +ComponentName.QuadFuelRodCoaxium=\u56db\u8054\u71c3\u6599\u68d2 (Coaxium) +ComponentName.QuadFuelRodMox=\u56db\u8054\u71c3\u6599\u68d2 (MOX) +ComponentName.QuadFuelRodNaquadah=\u56db\u8054\u71c3\u6599\u68d2 (\u7845\u5ca9) +ComponentName.QuadFuelRodThorium=\u56db\u8054\u71c3\u6599\u68d2 (\u948d) +ComponentName.QuadFuelRodUranium=\u56db\u8054\u71c3\u6599\u68d2 (\u94c0) +ComponentName.ReactorHeatExchanger=\u53cd\u5e94\u5806\u70ed\u4ea4\u6362\u5668 +ComponentName.ReactorHeatVent=\u53cd\u5e94\u5806\u6563\u70ed\u7247 +ComponentName.ReactorPlating=\u53cd\u5e94\u5806\u9694\u677f +ComponentName.RshCondensator=\u7ea2\u77f3\u51b7\u51dd\u6a21\u5757 +ComponentName.ThickNeutronReflector=\u52a0\u539a\u4e2d\u5b50\u53cd\u5c04\u677f + +ComponentTooltip.Broken=\u4e0a\u6b21\u6a21\u62df\u65f6\u5df2\u635f\u574f +ComponentTooltip.ResidualHeat=\u4e0a\u6b21\u6a21\u62df\u540e\u6709\u4f59\u70ed + +Config.CSVCheckbox=\u8f93\u51fa CSV \u6570\u636e +Config.CSVLimit=\u6a21\u62df\u79d2\u6570: +Config.EUReactor=EU \u53cd\u5e94\u5806 +Config.FluidReactor=\u6d41\u4f53\u53cd\u5e94\u5806 +Config.InitialComponentHeat=\u521d\u59cb\u70ed\u91cf: +Config.NoComponentSelected=\u672a\u9009\u62e9\u5143\u4ef6 +Config.OffPulse=\u8109\u51b2\u7684\u5173\u95ed\u6301\u7eed\u65f6\u95f4: +Config.OnPulse=\u8109\u51b2\u7684\u5f00\u542f\u6301\u7eed\u65f6\u95f4: +Config.PlacingReactorPause=\u53cd\u5e94\u5806\u6682\u505c: +Config.PlacingReplacementThreshold=\u9608\u503c: +Config.PulseHelp=(\u53ef\u4ee5\u5c06\u8109\u51b2\u7684\u5f00\u542f\u6301\u7eed\u65f6\u95f4\u8bbe\u7f6e\u4e3a 5,000,000 \u4ee5\u6a21\u62df\u6ca1\u6709\u7ea2\u77f3\u8ba1\u65f6\u7684\u60c5\u51b5) +Config.ReactorCoolantInjectors=\u4f7f\u7528\u53cd\u5e94\u5806\u51b7\u5374\u6db2\u6ce8\u5165\u5668 (\u4ec5\u9650 MC 1.8 \u4ee5\u4e0a) +Config.ReactorPause=\u53cd\u5e94\u5806\u6682\u505c (\u79d2): +Config.ReactorPauseHelp=(\u8fd9\u662f\u53cd\u5e94\u5806\u5728\u66f4\u6362\u8be5\u5143\u4ef6\u65f6\u6682\u505c\u7684\u65f6\u95f4) +Config.ReplacementThreshold=\u66f4\u6362\u9608\u503c: +Config.ReplacementThresholdHelp=(\u8bbe\u7f6e\u4e3a\u9ad8\u4e8e\u5143\u4ef6\u7684\u521d\u59cb\u70ed\u91cf/\u635f\u574f\u503c, \u4ee5\u5728\u5143\u4ef6\u8fc7\u70ed/\u635f\u574f\u65f6\u66f4\u6362\u8be5\u5143\u4ef6, \u6216\u8bbe\u7f6e\u4e3a\u4f4e\u4e8e\u5143\u4ef6\u7684\u521d\u59cb\u70ed\u91cf/\u635f\u574f\u503c, \u4ee5\u66f4\u6362\u5df2\u51b7\u5374\u7684\u5143\u4ef6; \u65e0\u8bba\u6b64\u8bbe\u7f6e\u5982\u4f55, \u5728\u81ea\u52a8\u5316\u8fd0\u884c\u671f\u95f4, \u90fd\u5c06\u66f4\u6362\u635f\u574f\u7684\u5143\u4ef6) +Config.ResumeTemp=\u6062\u590d\u53cd\u5e94\u5806 \u5f53\u5806\u6e29 <= +# Same language string should be usable anywhere "seconds" appears. +Config.Seconds=\u79d2 +Config.SimulationStyle=\u6a21\u62df\u6837\u5f0f: +Config.SuspendTemp=\u6682\u505c\u53cd\u5e94\u5806 \u5f53\u5806\u6e29 >= +Config.SuspendTempHelp=(\u53ef\u4ee5\u5c06\u4e24\u4e2a\u6e29\u5ea6\u8bbe\u7f6e\u4e3a\u4e0e\u7206\u70b8\u6e29\u5ea6\u5339\u914d, \u4ee5\u6a21\u62df\u6ca1\u6709\u6e29\u5ea6\u63a7\u5236\u7684\u60c5\u51b5) + +CSVData.EntryComponentValue=,"%.2f" +CSVData.EntryComponentOutput=,%.0f +CSVData.EntryCoreHeat=,%.0f +CSVData.EntryEUOutput=,"%.2f" +CSVData.EntryHUOutput=,%.0f +CSVData.EntryReactorTick=%d +CSVData.HeaderComponentName=,%s (R%dC%d) +CSVData.HeaderComponentOutput=,%s (R%dC%d) \u8f93\u51fa +CSVData.HeaderCoreHeat=,\u5806\u82af\u70ed\u91cf +CSVData.HeaderEUOutput=,EU \u8f93\u51fa +CSVData.HeaderHUOutput=,HU \u8f93\u51fa +CSVData.HeaderReactorTick=\u53cd\u5e94\u5806\u65f6\u95f4 + +MaterialName.AdvancedAlloy=\u9ad8\u7ea7\u5408\u91d1 +MaterialName.AdvancedCircuit=\u9ad8\u7ea7\u7535\u8def\u677f +MaterialName.Aluminium=\u94dd +MaterialName.BasicCircuit=\u57fa\u7840\u7535\u8def +MaterialName.Beryllium=\u94cd +MaterialName.Bronze=\u9752\u94dc +MaterialName.CesiumFuel=\u5bcc\u96c6\u94ef\u6838\u71c3\u6599 +MaterialName.Coal=\u7164 +MaterialName.CoaxiumFuel=\u5bcc\u96c6 Coaxium \u6838\u71c3\u6599 +MaterialName.Copper=\u94dc +MaterialName.Diamond=\u94bb\u77f3 +MaterialName.DistilledWater=\u84b8\u998f\u6c34 +MaterialName.EmptyCell=\u7a7a\u5355\u5143 +MaterialName.EnrichedNaquadah=\u5bcc\u96c6\u7845\u5ca9 +MaterialName.Glass=\u73bb\u7483 +MaterialName.GlowstoneDust=\u8424\u77f3\u7c89 +MaterialName.Gold=\u91d1 +MaterialName.Graphite=\u77f3\u58a8 +MaterialName.Helium==\u6c26 +MaterialName.Iridium=\u94f1 +MaterialName.IridiumReinforcedPlate=\u5f3a\u5316\u94f1\u677f +MaterialName.Iron=\u94c1 +MaterialName.LapisLazuli=\u9752\u91d1\u77f3 +MaterialName.Lead=\u94c5 +MaterialName.MoxFuel=MOX \u71c3\u6599 +MaterialName.Potassium=\u94be +MaterialName.Redstone=\u7ea2\u77f3 +MaterialName.Rubber=\u6a61\u80f6 +MaterialName.Sodium=\u94a0 +MaterialName.Thorium=\u948d +MaterialName.Tin=\u9521 +MaterialName.UraniumFuel=\u94c0\u71c3\u6599 + +# %s at the end of this string is for optionally showing the range of active time. +Simulation.ActiveTime=\u53cd\u5e94\u5806\u5904\u4e8e\u542f\u52a8\u72b6\u6001\u7684\u65f6\u95f4\u603b\u8ba1 %,d \u79d2 %s .\n +Simulation.ActiveTimeRange=\u0020(%,d \u5230 %,d \u79d2\u4e00\u6b21) +Simulation.ActiveTimeSingle=\u0020(%,d \u79d2\u4e00\u6b21) +Simulation.CancelledAtTick=\u6a21\u62df %,d \u79d2\u540e\u53d6\u6d88\u6a21\u62df.\n +Simulation.ComponentHeating=\u5143\u4ef6\u4ea7\u70ed: \u5e73\u5747: %.2f .\n +Simulation.ComponentsReplaced=\u66f4\u6362\u7684\u5143\u4ef6:\n%s +Simulation.CSVOpenFailure=\u65e0\u6cd5\u6253\u5f00 CSV \u6587\u4ef6\u8fdb\u884c\u8f93\u51fa.\n +Simulation.CycleCompleteTime=%,d \u79d2\u540e\u5faa\u73af\u5b8c\u6210.\n +# This will be used to optionally show extra precision, in format strings where %s is used when %.2f might otherwise be expected. +Simulation.DecimalFormat=#,##0.## +Simulation.Efficiency=\u6548\u7387: \u5e73\u5747: %.2f , \u6700\u5c0f: %.2f , \u6700\u5927: %.2f \n +Simulation.ElapsedTime=\u6a21\u62df\u8017\u65f6 %.2f \u79d2.\n +Simulation.ErrorCooldown=\u9519\u8bef %,d \u6a21\u62df\u51b7\u5374\u65f6\u95f4.\n +Simulation.ErrorReactor=\u6a21\u62df\u53cd\u5e94\u5806\u542f\u52a8\u7684 %d \u79d2\u540e\u53d1\u751f\u9519\u8bef\n +Simulation.EUOutputs=\u5b8c\u6210\u6a21\u62df\u540e\u7684\u603b\u8f93\u51fa: %s EU (\u5e73\u5747: %s EU/t, \u6700\u5c0f: %s EU/t, \u6700\u5927: %s EU/t)\n +Simulation.EUOutputsBeforeDepleted=\u7b2c\u4e00\u6839\u71c3\u6599\u68d2\u8017\u5c3d\u524d\u7684\u603b\u8f93\u51fa: %s EU (\u5e73\u5747: %s EU/t, \u6700\u5c0f: %s EU/t, \u6700\u5927: %s EU/t)\n +Simulation.EUOutputsBeforeBreak=\u4e00\u4e2a\u5143\u4ef6\u635f\u574f\u524d\u7684\u603b\u8f93\u51fa: %s EU (\u5e73\u5747: %s EU/t, \u6700\u5c0f: %s EU/t, \u6700\u5927: %s EU/t)\n +Simulation.ExcessCooling=\u8fc7\u51b7: %.2f\n +Simulation.ExcessHeating=\u8fc7\u70ed: %.2f\n +Simulation.ExplosionPower=\u7206\u70b8\u5a01\u529b: %,.2f\n +Simulation.FirstComponentBrokenDetails=\u7b2c\u4e00\u4e2a\u5143\u4ef6\u635f\u574f: %s \u7b2c %d \u884c %d \u5217, \u7528\u4e86 %d \u79d2.\n +Simulation.FirstRodDepletedDetails=\u7b2c\u4e00\u6839\u71c3\u6599\u68d2\u8017\u5c3d: %s \u7b2c %d \u884c %d \u5217, \u7528\u4e86 %d \u79d2.\n +Simulation.FuelRodsTime=\u71c3\u6599\u68d2 (\u5982\u679c\u6709) \u5728 %,d \u79d2\u540e\u505c\u6b62.\n +Simulation.HeatOutputs=\u5b8c\u5168\u6a21\u62df\u540e\u7684\u603b\u8f93\u51fa: %s HU (\u5e73\u5747: %s HU/t, \u6700\u5c0f: %s HU/t, \u6700\u5927: %s HU/t)\n +Simulation.HeatOutputsBeforeBreak=\u7b2c\u4e00\u4e2a\u5143\u4ef6\u635f\u574f\u4e4b\u524d\u7684\u603b\u8f93\u51fa: %s HU (\u5e73\u5747: %s HU/t, \u6700\u5c0f: %s HU/t, \u6700\u5927: %s HU/t)\n +Simulation.HeatOutputsBeforeDepleted=\u5728\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d\u7684\u603b\u8f93\u51fa: %s HU (\u5e73\u5747: %s HU/t, \u6700\u5c0f: %s HU/t, \u6700\u5927: %s HU/t)\n +Simulation.HullCooling=\u53cd\u5e94\u5806\u51b7\u5374: %,.2f \u5e73\u5747\u4e8e %,.0f \u53ef\u80fd\u503c.\n +Simulation.HullHeating=\u53cd\u5e94\u5806\u4ea7\u70ed: \u5e73\u5747: %,.2f .\n +Simulation.InactiveTime=\u53cd\u5e94\u5806\u5904\u4e8e\u505c\u6b62\u72b6\u6001\u7684\u65f6\u95f4\u603b\u8ba1 %,d \u79d2 %s .\n +Simulation.InactiveTimeRange=\u0020(%,d \u5230 %,d \u79d2\u4e00\u6b21) +Simulation.InactiveTimeSingle=\u0020(%,d \u79d2\u4e00\u6b21) +Simulation.LapisUsed=\u7528\u4e86 %d \u5757\u9752\u91d1\u77f3.\n +Simulation.MaxHeatGenerated=\u4ea7\u751f\u7684\u6700\u5927\u70ed\u91cf (\u5185\u90e8, \u7531\u71c3\u6599\u68d2\u4ea7\u751f): %,.0f\n +Simulation.NoCooldown=\u4e0d\u9700\u8981\u51b7\u5374.\n +Simulation.NoFuelRods=\u6ca1\u6709\u627e\u5230\u71c3\u6599\u68d2! \u6a21\u62df\u8109\u51b2\u5faa\u73af\u65e0\u610f\u4e49! +Simulation.ReactorCooldownTime=\u53cd\u5e94\u5806\u51b7\u5374\u65f6\u95f4\u4e3a %,d \u79d2.\n +Simulation.ReactorHeatBuildup=\u6bcf\u79d2\u53cd\u5e94\u5806\u70ed\u91cf\u7d2f\u79ef (\u6240\u6709\u5143\u4ef6\u90fd\u5b8c\u597d\u65f6): \u6700\u5c0f: %,.0f , \u6700\u5927: %,.0f .\n +Simulation.ReactorMaxTemp=\u53cd\u5e94\u5806\u6700\u9ad8\u6e29\u5ea6: %,.0f\n +Simulation.ReactorMaxTempBeforeDepleted=\u53cd\u5e94\u5806\u6700\u9ad8\u6e29\u5ea6 (\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d): %,.0f\n +Simulation.ReactorMinTemp=\u53cd\u5e94\u5806\u6700\u4f4e\u6e29\u5ea6: %,.0f\n +Simulation.ReactorMinTempBeforeDepleted=\u53cd\u5e94\u5806\u6700\u4f4e\u6e29\u5ea6 (\u7b2c\u4e00\u4e2a\u71c3\u6599\u68d2\u8017\u5c3d\u4e4b\u524d): %,.0f\n +Simulation.ReactorOverheatedTime=\u53cd\u5e94\u5806\u5728 %,d \u79d2\u65f6\u8fc7\u70ed.\n +Simulation.ReactorRemainingHeat=\u6a21\u62df\u5b8c\u6210\u540e, \u53cd\u5e94\u5806\u7684\u70ed\u91cf\u4fdd\u6301\u5728 %,.0f .\n +Simulation.ReactorResidualHeat=\u53cd\u5e94\u5806\u5728\u51b7\u5374 %,d \u79d2\u540e\u70ed\u91cf\u4ecd\u4fdd\u6301\u5728 %,.0f .\n +Simulation.RedstoneUsed=\u4f7f\u7528\u4e86 %d \u5757\u7ea2\u77f3.\n +Simulation.Started=\u6a21\u62df\u5f00\u59cb.\n +Simulation.TimeToBelow50=\u53cd\u5e94\u5806\u70ed\u91cf\u5c06\u4f1a\u5728 %d \u79d2\u540e\u9996\u6b21\u964d\u81f3 50%% \u4ee5\u4e0b (\u5728\u9ad8\u4e8e 50%% \u4e4b\u540e).\n +Simulation.TimeToBurn=\u53cd\u5e94\u5806\u5c06\u5728 %d \u79d2\u540e\u8fbe\u5230"\u71c3\u70e7"\u6e29\u5ea6.\n +Simulation.TimeToEvaporate=\u53cd\u5e94\u5806\u5c06\u5728 %d \u79d2\u540e\u8fbe\u5230"\u84b8\u53d1"\u6e29\u5ea6.\n +Simulation.TimeToHurt=\u53cd\u5e94\u5806\u5c06\u5728 %d \u79d2\u540e\u8fbe\u5230"\u4f24\u5bb3"\u6e29\u5ea6.\n +Simulation.TimeToLava=\u53cd\u5e94\u5806\u5c06\u5728 %d \u79d2\u540e\u8fbe\u5230"\u7194\u5316"\u6e29\u5ea6.\n +# Note: The "e" is deliberately dropped from "Explode" in the key name so that it will sort after the others. +Simulation.TimeToXplode=\u53cd\u5e94\u5806\u5c06\u5728 %d \u79d2\u5185\u7206\u70b8.\n +Simulation.TimeWithoutExploding=\n\u53cd\u5e94\u5806\u8fd0\u884c %,d \u79d2\u540e\u6ca1\u6709\u7206\u70b8.\n +Simulation.TotalCellCooling=\u603b\u71c3\u6599\u68d2\u51b7\u5374 (\u5cf0\u503c\u4f7f\u7528): %,.2f\n +Simulation.TotalCondensatorCooling=\u51b7\u51dd\u5668\u603b\u51b7\u5374\u91cf (\u5cf0\u503c\u4f7f\u7528\u91cf): %,.2f\n +Simulation.TotalCooldownTime=\u5176\u4ed6\u5143\u4ef6\u9700\u8981 %,d \u79d2\u6765\u51b7\u5374 (\u5c3d\u53ef\u80fd\u591a\u7684\u65f6\u95f4).\n +Simulation.TotalVentCooling=\u603b\u7a7a\u6c14\u51b7\u5374 (\u5cf0\u503c\u7528\u6cd5, \u7406\u8bba\u6700\u5927\u503c): %,.2f \u4e8e %,.2f\n +Simulation.VentCooling=\u6563\u70ed\u7247\u51b7\u5374: %,.2f \u5e73\u5747\u4e8e %,.0f \u53ef\u80fd\u503c.\n + +UI.AdvancedTab=\u9ad8\u7ea7 +#Needs to be heavily abbreviated to fit on the button. +UI.AutomateButton=a +UI.AutomateButtonFont=Arial 10 +UI.AutomatedReactor=\u81ea\u52a8\u5316\u53cd\u5e94\u5806 +UI.AutomationTooltip=\u5355\u51fb\u6b64\u5904\u53ef\u5b9a\u4e49\u6b64\u5143\u4ef6\u7684\u81ea\u52a8\u5316\u89c4\u5219. +UI.CancelButton=\u53d6\u6d88 +UI.ChosenComponentRowCol=%s \u7b2c %d \u884c %d \u5217 +UI.ClearGridButton=\u6e05\u9664 +UI.CodeLabel=\u4ee3\u7801: +UI.ComparisonTab=\u6bd4\u8f83\u65b9\u5f0f +UI.ComponentAutomationTab=\u5143\u4ef6\u81ea\u52a8\u5316 +#Needs to be heavily abbreviated to fit on the button. +UI.ComponentInfoButton=i +UI.ComponentInfoButtonFont=Arial 10 +UI.ComponentInfoButtonTooltip=\u5355\u51fb\u4ee5\u83b7\u53d6\u6709\u5173\u6b64\u5143\u4ef6\u7684\u4fe1\u606f +UI.ComponentInfoDefault=\u8bf7\u8fd0\u884c\u6a21\u62df\u5e76\u9009\u62e9\u4e0a\u9762\u53cd\u5e94\u5806\u7f51\u683c\u4e2d\u7684\u5143\u4ef6\u4ee5\u67e5\u770b\u5176\u8be6\u7ec6\u4fe1\u606f. +UI.ComponentInfoLastSimRowCol=%s \u7b2c %d \u884c %d \u5217\n%s +UI.ComponentListTab=\u5143\u4ef6\u6e05\u5355 +UI.ComponentPlacingDefault=\u653e\u7f6e\u5143\u4ef6: \u65e0 +UI.ComponentPlacingSpecific=\u653e\u7f6e\u5143\u4ef6: %s +UI.ComponentTab=\u5143\u4ef6 +UI.CopyCodeButton=\u590d\u5236\u4ee3\u7801 +UI.CopyComparisonData=\u590d\u5236\u6bd4\u8f83\u6570\u636e +UI.CSVBrowseButton=\u6d4f\u89c8 +UI.CSVFileDefault=\u672a\u9009\u62e9\u6587\u4ef6 +UI.CSVHelp=\u8b66\u544a:
  1. \u542f\u7528 CSV \u8f93\u51fa\u540e, \u6a21\u62df\u8fd0\u884c\u53ef\u80fd\u4f1a\u6162\u5f97\u591a, \u5c24\u5176\u662f\u6240\u9009\u6587\u4ef6\u4f4d\u4e8e\u673a\u68b0\u786c\u76d8\u4e0a\u65f6.
  2. \u7528\u6237\u5e94\u786e\u4fdd\u76ee\u6807\u9a71\u52a8\u5668\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u5bb9\u7eb3 CSV \u6587\u4ef6.
  3. \u9664\u975e\u624b\u52a8\u66f4\u6539\u76ee\u6807, \u5426\u5219\u5176\u4ed6\u6a21\u62df\u5c06\u8986\u76d6 CSV \u6587\u4ef6.
+UI.CSVTab=CSV +UI.EnableGT508Components=\u542f\u7528 GT 5.08 \u5143\u4ef6 +UI.EnableGT509Components=\u542f\u7528 GT 5.09 \u5143\u4ef6 +UI.ExpandAdvancedAlloy=\u5c06\u9ad8\u7ea7\u5408\u91d1\u6269\u5c55\u6210\u5143\u4ef6\u6750\u6599 (\u4f7f\u7528\u683c\u96f7\u79d1\u6280\u65f6\u65e0\u6548) +UI.GregTechVersion=\u683c\u96f7\u79d1\u6280 \u7248\u672c: +UI.GregTechVersionNone=\u65e0 +UI.GT509ReactorBehavior=\u4f7f\u7528 GT 5.09 \u53cd\u5e94\u5806\u7279\u6027 (\u71c3\u6599\u68d2\u4ea7\u751f 2 \u500d\u7684\u57fa\u672c EU \u751f\u6210\u91cf, \u65e0\u8bba\u6b64\u8bbe\u7f6e\u5982\u4f55, \u53ea\u9002\u7528\u4e8e GT 5.09 \u7684\u71c3\u6599\u68d2) +UI.InitialHeatDisplay=\u0020(\u521d\u59cb\u70ed\u91cf: %,d) +UI.InitialReactorHeat=\u53cd\u5e94\u5806\u521d\u59cb\u70ed\u91cf: +UI.LockInTabCode=\u9501\u5b9a\u9009\u9879\u5361\u4ee3\u7801 +UI.MainTitle=\u5de5\u4e1a2 \u5b9e\u9a8c\u7248 \u6838\u7535\u6a21\u62df\u5668 +UI.MaterialDecimalFormat=#,##0.## +UI.MaterialsTab=\u6750\u6599 +UI.MaxHeatDefault=/10,000 +UI.MaxHeatSpecific=/%,.0f +UI.MaxSimulationTicks=\u6700\u5927\u6a21\u62df\u65f6\u95f4: +UI.MaxSimulationTicksTooltip=\u5373\u4f7f\u53cd\u5e94\u5806\u6ca1\u6709\u7206\u70b8\u6216\u505c\u6b62\u8f93\u51fa HU \u6216 EU, \u5728\u957f\u65f6\u95f4\u6a21\u62df\u540e, \u4e5f\u4f1a\u8feb\u4f7f\u6a21\u62df\u505c\u6b62\u3002 +UI.MinecraftVersion=Minecraft \u7248\u672c: +UI.NoComponentLastSimRowCol=\u5728\u4e0a\u6b21\u6a21\u62df\u671f\u95f4\u7b2c %d \u884c %d \u5217 \u6ca1\u6709\u5143\u4ef6. +UI.NoComponentRowCol=\u7b2c %d \u884c %d \u5217 \u6ca1\u6709\u5143\u4ef6. +UI.NoSimulationRun=\u5c1a\u672a\u8fd0\u884c\u6a21\u62df. +UI.OnlyShowDiffData=\u53ea\u663e\u793a\u660e\u663e\u4e0d\u540c\u7684\u6570\u636e +UI.PasteCodeButton=\u7c98\u8d34\u4ee3\u7801 +UI.PulseConfigurationTab=\u8109\u51b2\u914d\u7f6e +UI.PulsedReactor=\u8109\u51b2\u578b\u53cd\u5e94\u5806 +UI.RemoveAddonComponentsTitle=\u627e\u5230\u9644\u52a0\u5143\u4ef6 +UI.RemoveGT508ComponentsText=\u5f53\u524d\u8bbe\u8ba1\u4e2d\u53d1\u73b0 GT 5.08 \u7684\u5143\u4ef6\u3002\u662f\u5426\u79fb\u9664\u5b83\u4eec? +UI.RemoveGT509ComponentsText=\u5f53\u524d\u8bbe\u8ba1\u4e2d\u53d1\u73b0 GT 5.09 \u7684\u5143\u4ef6\u3002\u662f\u5426\u79fb\u9664\u5b83\u4eec? +UI.ResetPulseConfig=\u91cd\u7f6e\u8109\u51b2\u914d\u7f6e +UI.ShowComponentDetailButtons=\u663e\u793a\u5143\u4ef6\u8be6\u7ec6\u4fe1\u606f\u6309\u94ae +UI.ShowComponentPreconfigControls=\u663e\u793a\u5143\u4ef6\u9884\u914d\u7f6e\u63a7\u4ef6 +UI.ShowOldStyleReactorCode=\u663e\u793a\u65e7 (2.3.1 \u4e4b\u524d\u7248\u672c) \u53cd\u5e94\u5806\u4ee3\u7801 +UI.SimulateButton=\u6a21\u62df +UI.SimulationTab=\u6a21\u62df +UI.SimulationTypeAutomation=\u8109\u51b2\u81ea\u52a8\u5316 +UI.SimulationTypePulsed=\u8109\u51b2\u578b\u5faa\u73af +UI.SimulationTypeSimple=\u7b80\u5355\u578b\u5faa\u73af +UI.TemperatureEffectsDefault=\u71c3\u70e7: 4,000 \u84b8\u53d1: 5,000 \u4f24\u5bb3: 7,000 \u7194\u5316: 8,500 \u7206\u70b8: 10,000 +UI.TemperatureEffectsSpecific=\u71c3\u70e7: %,d \u84b8\u53d1: %,d \u4f24\u5bb3: %,d \u7194\u5316: %,d \u7206\u70b8: %,d +UI.TexturePackBrowseButton=\u6d4f\u89c8 +UI.TexturePackClearButton=\u6e05\u9664 +UI.TexturePackDefault=\u6750\u8d28\u5305: \u672a\u9009\u62e9\u6587\u4ef6 +UI.TexturePackHelp=(\u91cd\u65b0\u542f\u52a8\u6a21\u62df\u5668\u4ee5\u67e5\u770b\u65b0\u6750\u8d28) +UI.TexturePackSpecific=\u6750\u8d28\u5305: %s +UI.UseGTRecipes=\u4f7f\u7528\u683c\u96f7\u79d1\u6280\u914d\u65b9\u5236\u4f5c\u5143\u4ef6\u6750\u6599 (\u5982\u9002\u7528\u4e14\u660e\u786e) +UI.UseUfcForCoolantCells=\u4f7f\u7528\u901a\u7528\u6d41\u4f53\u5355\u5143\u4f5c\u4e3a\u51b7\u5374\u5242 (\u4e0e\u683c\u96f7\u79d1\u6280\u914d\u65b9\u4e0d\u517c\u5bb9) +UI.VersionNumber=\u7248\u672c %s + +Warning.DepletedIsotope=\u5220\u9664\u4e86 (\u8fd1\u8870\u53d8\u94c0\u68d2) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n +Warning.DualPlutonium=\u5220\u9664\u4e86 (\u53cc\u8054\u71c3\u6599\u68d2 (\u949a)) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n +Warning.Heating=\u5220\u9664\u4e86 (\u52a0\u70ed\u5143\u4ef6) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n +Warning.InvalidReactorCode=\u65e0\u6548\u7684\u53cd\u5e94\u5806\u4ee3\u7801: %s +Warning.Plutonium=\u5220\u9664\u4e86 (\u71c3\u6599\u68d2 (\u949a)) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n +Warning.QuadPlutonium=\u5220\u9664\u4e86 (\u56db\u8054\u71c3\u6599\u68d2 (\u949a)) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n +Warning.Title=\u8b66\u544a +Warning.Unrecognized=\u5220\u9664\u4e86\u65e0\u6cd5\u8bc6\u522b\u7684\u5143\u4ef6 (id %d) \u4f4d\u4e8e\u7b2c %d \u884c %d \u5217.\n diff --git a/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java new file mode 100644 index 0000000000..dc27a6a730 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java @@ -0,0 +1,224 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner; + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.stream.Collectors; + +import Ic2ExpReactorPlanner.components.Condensator; +import Ic2ExpReactorPlanner.components.CoolantCell; +import Ic2ExpReactorPlanner.components.Exchanger; +import Ic2ExpReactorPlanner.components.FuelRod; +import Ic2ExpReactorPlanner.components.Plating; +import Ic2ExpReactorPlanner.components.ReactorItem; +import Ic2ExpReactorPlanner.components.Reflector; +import Ic2ExpReactorPlanner.components.Vent; +import gregtech.api.enums.ItemList; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.bartworks.BW_Utils; +import gtPlusPlus.xmod.bartworks.BW_Utils.NonMeta_MaterialItem; +import gtPlusPlus.xmod.goodgenerator.GG_Utils; +import gtPlusPlus.xmod.goodgenerator.GG_Utils.GG_Fuel_Rod; + +/** + * Factory class to handle creating components by id or name. + * @author Brian McCloud + */ +public class ComponentFactory { + + static ItemList[] aGtItems = new ItemList[]{ + ItemList.Neutron_Reflector, + ItemList.Moxcell_1, + ItemList.Moxcell_2, + ItemList.Moxcell_4 + }; + + private ComponentFactory() { + // do nothing, this class should not be instantiated. + } + + private static LinkedHashMap ITEM_LIST = new LinkedHashMap(); + + static { + int aID = 0; + ITEM_LIST.put(aID++, null); + ITEM_LIST.put(aID++, new FuelRod(1, "fuelRodUranium", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumSimple", 1).copy()), 20e3, 1, null, 100, 2, 1, false)); + ITEM_LIST.put(aID++, new FuelRod(2, "dualFuelRodUranium", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumDual", 1).copy()), 20e3, 1, null, 200, 4, 2, false)); + ITEM_LIST.put(aID++, new FuelRod(3, "quadFuelRodUranium", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumQuad", 1).copy()), 20e3, 1, null, 400, 8, 4, false)); + ITEM_LIST.put(aID++, new FuelRod(4, "fuelRodMox", new GT_ItemStack(aGtItems[1].get(1).copy()), 10e3, 1, null, 100, 2, 1, true)); + ITEM_LIST.put(aID++, new FuelRod(5, "dualFuelRodMox", new GT_ItemStack(aGtItems[2].get(1).copy()), 10e3, 1, null, 200, 4, 2, true)); + ITEM_LIST.put(aID++, new FuelRod(6, "quadFuelRodMox", new GT_ItemStack(aGtItems[3].get(1).copy()), 10e3, 1, null, 400, 8, 4, true)); + ITEM_LIST.put(aID++, new Reflector(7, "neutronReflector", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorReflector", 1).copy()), 30e3, 1, null)); + ITEM_LIST.put(aID++, new Reflector(8, "thickNeutronReflector", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorReflectorThick", 1).copy()), 120e3, 1, null)); + ITEM_LIST.put(aID++, new Vent(9, "heatVent", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVent", 1).copy()), 1, 1000, null, 6, 0, 0)); + ITEM_LIST.put(aID++, new Vent(10, "advancedHeatVent", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentDiamond", 1).copy()), 1, 1000, null, 12, 0, 0)); + ITEM_LIST.put(aID++, new Vent(11, "reactorHeatVent", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentCore", 1).copy()), 1, 1000, null, 5, 5, 0)); + ITEM_LIST.put(aID++, new Vent(12, "componentHeatVent", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentSpread", 1).copy()), 1, 1, null, 0, 0, 4)); + ITEM_LIST.put(aID++, new Vent(13, "overclockedHeatVent", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentGold", 1).copy()), 1, 1000, null, 20, 36, 0)); + ITEM_LIST.put(aID++, new CoolantCell(14, "coolantCell10k", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantSimple", 1).copy()), 1, 10e3, null)); + ITEM_LIST.put(aID++, new CoolantCell(15, "coolantCell30k", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantTriple", 1).copy()), 1, 30e3, null)); + ITEM_LIST.put(aID++, new CoolantCell(16, "coolantCell60k", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantSix", 1).copy()), 1, 60e3, null)); + ITEM_LIST.put(aID++, new Exchanger(17, "heatExchanger", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitch", 1).copy()), 1, 2500, null, 12, 4)); + ITEM_LIST.put(aID++, new Exchanger(18, "advancedHeatExchanger", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchDiamond", 1).copy()), 1, 10e3, null, 24, 8)); + ITEM_LIST.put(aID++, new Exchanger(19, "coreHeatExchanger", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchCore", 1).copy()), 1, 5000, null, 0, 72)); + ITEM_LIST.put(aID++, new Exchanger(20, "componentHeatExchanger", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchSpread", 1).copy()), 1, 5000, null, 36, 0)); + ITEM_LIST.put(aID++, new Plating(21, "reactorPlating", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlating", 1).copy()), 1, 1, null, 1000, 0.9025)); + ITEM_LIST.put(aID++, new Plating(22, "heatCapacityReactorPlating", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingHeat", 1).copy()), 1, 1, null, 1700, 0.9801)); + ITEM_LIST.put(aID++, new Plating(23, "containmentReactorPlating", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingExplosive", 1).copy()), 1, 1, null, 500, 0.81)); + ITEM_LIST.put(aID++, new Condensator(24, "rshCondensator", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensator", 1).copy()), 1, 20e3, null)); + ITEM_LIST.put(aID++, new Condensator(25, "lzhCondensator", new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensatorLap", 1).copy()), 1, 100e3, null)); + ITEM_LIST.put(aID++, new FuelRod(26, "fuelRodThorium", new GT_ItemStack(ItemList.ThoriumCell_1.get(1).copy()), 50e3, 1, "GregTech", 20, 0.5, 1, false)); + ITEM_LIST.put(aID++, new FuelRod(27, "dualFuelRodThorium", new GT_ItemStack(ItemList.ThoriumCell_2.get(1).copy()), 50e3, 1, "GregTech", 40, 1, 2, false)); + ITEM_LIST.put(aID++, new FuelRod(28, "quadFuelRodThorium", new GT_ItemStack(ItemList.ThoriumCell_4.get(1).copy()), 50e3, 1, "GregTech", 80, 2, 4, false)); + ITEM_LIST.put(aID++, new CoolantCell(29, "coolantCellHelium60k", new GT_ItemStack(ItemList.Reactor_Coolant_He_1.get(1).copy()), 1, 60e3, "GregTech")); + ITEM_LIST.put(aID++, new CoolantCell(30, "coolantCellHelium180k", new GT_ItemStack(ItemList.Reactor_Coolant_He_3.get(1).copy()), 1, 180e3, "GregTech")); + ITEM_LIST.put(aID++, new CoolantCell(31, "coolantCellHelium360k", new GT_ItemStack(ItemList.Reactor_Coolant_He_6.get(1).copy()), 1, 360e3, "GregTech")); + ITEM_LIST.put(aID++, new CoolantCell(32, "coolantCellNak60k", new GT_ItemStack(ItemList.Reactor_Coolant_NaK_1.get(1).copy()), 1, 60e3, "GregTech")); + ITEM_LIST.put(aID++, new CoolantCell(33, "coolantCellNak180k", new GT_ItemStack(ItemList.Reactor_Coolant_NaK_3.get(1).copy()), 1, 180e3, "GregTech")); + ITEM_LIST.put(aID++, new CoolantCell(34, "coolantCellNak360k", new GT_ItemStack(ItemList.Reactor_Coolant_NaK_3.get(1).copy()), 1, 360e3, "GregTech")); + ITEM_LIST.put(aID++, new Reflector(35, "iridiumNeutronReflector", new GT_ItemStack(ItemList.Neutron_Reflector.get(1).copy()), 1, 1, null)); + ITEM_LIST.put(aID++, new FuelRod(36, "fuelRodNaquadah", new GT_ItemStack(ItemList.NaquadahCell_1.get(1).copy()), 100e3, 1, "GregTech", 100, 2, 1, true)); + ITEM_LIST.put(aID++, new FuelRod(37, "dualFuelRodNaquadah", new GT_ItemStack(ItemList.NaquadahCell_2.get(1).copy()), 100e3, 1, "GregTech", 200, 4, 2, true)); + ITEM_LIST.put(aID++, new FuelRod(38, "quadFuelRodNaquadah", new GT_ItemStack(ItemList.NaquadahCell_4.get(1).copy()), 100e3, 1, "GregTech", 400, 8, 4, true)); + + //aID = 39; + //ITEM_LIST.put(aID++, new FuelRod(39, "fuelRodCoaxium", null, 20e3, 1, "Coaxium", 100, 0, 1, false)); + //ITEM_LIST.put(aID++, new FuelRod(40, "dualFuelRodCoaxium", null, 20e3, 1, "Coaxium", 200, 0, 2, false)); + //ITEM_LIST.put(aID++, new FuelRod(41, "quadFuelRodCoaxium", null, 20e3, 1, "Coaxium", 400, 0, 4, false)); + //ITEM_LIST.put(aID++, new FuelRod(42, "fuelRodCesium", null, 10861, 1, "Coaxium", 200, 1, 1, false)); + //ITEM_LIST.put(aID++, new FuelRod(43, "dualFuelRodCesium", null, 10861, 1, "Coaxium", 400, 6, 2, false)); + //ITEM_LIST.put(aID++, new FuelRod(44, "quadFuelRodCesium", null, 10861, 1, "Coaxium", 800, 24, 4, false)); + + aID = 45; + ITEM_LIST.put(aID++, new FuelRod(45, "fuelRodNaquadahGTNH", new GT_ItemStack(ItemList.NaquadahCell_1.get(1).copy()), 100e3, 1, "GTNH", 100, 2, 1, false));//Naq rods are not MOX-like in GTNH, + ITEM_LIST.put(aID++, new FuelRod(46, "dualFuelRodNaquadahGTNH", new GT_ItemStack(ItemList.NaquadahCell_2.get(1).copy()), 100e3, 1, "GTNH", 200, 4, 2, false));//we have naquadria for that + ITEM_LIST.put(aID++, new FuelRod(47, "quadFuelRodNaquadahGTNH", new GT_ItemStack(ItemList.NaquadahCell_4.get(1).copy()), 100e3, 1, "GTNH", 400, 8, 4, false)); + ITEM_LIST.put(aID++, new FuelRod(48, "fuelRodNaquadria", new GT_ItemStack(ItemList.MNqCell_1.get(1).copy()), 100e3, 1, "GTNH", 100, 2, 1, true)); + ITEM_LIST.put(aID++, new FuelRod(49, "dualFuelRodNaquadria", new GT_ItemStack(ItemList.MNqCell_2.get(1).copy()), 100e3, 1, "GTNH", 200, 4, 2, true)); + ITEM_LIST.put(aID++, new FuelRod(50, "quadFuelRodNaquadria", new GT_ItemStack(ItemList.MNqCell_4.get(1).copy()), 100e3, 1, "GTNH", 400, 8, 4, true)); + + aID = 51; + if (LoadedMods.BartWorks) { + ITEM_LIST.put(aID++, new FuelRod(51, "fuelRodTiberium", new GT_ItemStack(BW_Utils.getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_1, 1)), 50e3, 1, "Bartworks", 100, 1, 1, false)); + ITEM_LIST.put(aID++, new FuelRod(52, "dualFuelRodTiberium", new GT_ItemStack(BW_Utils.getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_2, 1)), 50e3, 1, "Bartworks", 200, 2, 2, false)); + ITEM_LIST.put(aID++, new FuelRod(53, "quadFuelRodTiberium", new GT_ItemStack(BW_Utils.getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_4, 1)), 50e3, 1, "Bartworks", 400, 4, 4, false)); + ITEM_LIST.put(aID++, new FuelRod(54, "fuelRodTheCore", new GT_ItemStack(BW_Utils.getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TheCoreCell, 1)), 100e3, 1, "Bartworks", 72534, 816, 32, false)); + } + + aID = 55; + ITEM_LIST.put(aID++, new CoolantCell(55, "coolantCellSpace180k", new GT_ItemStack(ItemList.Reactor_Coolant_Sp_1.get(1).copy()), 1, 180e3, "GTNH")); + ITEM_LIST.put(aID++, new CoolantCell(56, "coolantCellSpace360k", new GT_ItemStack(ItemList.Reactor_Coolant_Sp_2.get(1).copy()), 1, 360e3, "GTNH")); + ITEM_LIST.put(aID++, new CoolantCell(57, "coolantCellSpace540k", new GT_ItemStack(ItemList.Reactor_Coolant_Sp_3.get(1).copy()), 1, 540e3, "GTNH")); + ITEM_LIST.put(aID++, new CoolantCell(58, "coolantCellSpace1080k", new GT_ItemStack(ItemList.Reactor_Coolant_Sp_6.get(1).copy()), 1, 1080e3, "GTNH")); + + aID = 59; + if (LoadedMods.GoodGenerator) { + ITEM_LIST.put(aID++, new FuelRod(59, "fuelRodCompressedUranium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium, 1)), 50e3, 1, "GoodGenerator", 100, 1, 1, false)); + ITEM_LIST.put(aID++, new FuelRod(60, "fuelRodDoubleCompressedUranium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium_2, 1)), 50e3, 1, "GoodGenerator", 100, 1, 2, false)); + ITEM_LIST.put(aID++, new FuelRod(61, "fuelRodQuadCompressedUranium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium_4, 1)), 50e3, 1, "GoodGenerator", 100, 1, 4, false)); + ITEM_LIST.put(aID++, new FuelRod(62, "fuelRodCompressedPlutonium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium, 1)), 50e3, 1, "GoodGenerator", 50, 1, 1, true)); + ITEM_LIST.put(aID++, new FuelRod(63, "fuelRodDoubleCompressedPlutonium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium_2, 1)), 50e3, 1, "GoodGenerator", 50, 1, 2, true)); + ITEM_LIST.put(aID++, new FuelRod(64, "fuelRodQuadCompressedPlutonium", new GT_ItemStack(GG_Utils.getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium_4, 1)), 50e3, 1, "GoodGenerator", 50, 1, 4, true)); + } + + } + + private static final Map ITEM_MAP = makeItemMap(); + + private static Map makeItemMap() { + Map result = new HashMap<>((int)(ITEM_LIST.size() * 1.5)); + for (ReactorItem reactorItem : ITEM_LIST.values()) { + if (reactorItem != null) { + result.put(reactorItem.baseName, reactorItem); + } + } + return Collections.unmodifiableMap(result); + } + + private static ReactorItem copy(ReactorItem source) { + if (source != null) { + Class aClass = source.getClass(); + if (aClass == Condensator.class) { + return new Condensator((Condensator) source); + } else if (aClass == CoolantCell.class) { + return new CoolantCell((CoolantCell) source); + } else if (aClass == Exchanger.class) { + return new Exchanger((Exchanger) source); + } else if (aClass == FuelRod.class) { + return new FuelRod((FuelRod) source); + } else if (aClass == Plating.class) { + return new Plating((Plating) source); + } else if (aClass == Reflector.class) { + return new Reflector((Reflector) source); + } else if (aClass == Vent.class) { + return new Vent((Vent) source); + } + } + return null; + } + + /** + * Gets a default instances of the specified component (such as for drawing button images) + * @param id the id of the component. + * @return the component with the specified id, or null if the id is out of range. + */ + public static ReactorItem getDefaultComponent(int id) { + if (id >= 0 && id < ITEM_LIST.size()) { + return ITEM_LIST.get(id); + } + return null; + } + + /** + * Gets a default instances of the specified component (such as for drawing button images) + * @param name the name of the component. + * @return the component with the specified name, or null if the name is not found. + */ + public static ReactorItem getDefaultComponent(String name) { + if (name != null) { + return ITEM_MAP.get(name); + } + return null; + } + + /** + * Creates a new instance of the specified component. + * @param id the id of the component to create. + * @return a new instance of the specified component, or null if the id is out of range. + */ + public static ReactorItem createComponent(int id) { + if (id >= 0 && id < ITEM_LIST.size()) { + return copy(ITEM_LIST.get(id)); + } + return null; + } + + /** + * Creates a new instance of the specified component. + * @param name the name of the component to create. + * @return a new instance of the specified component, or null if the name is not found. + */ + public static ReactorItem createComponent(String name) { + if (name != null) { + return copy(ITEM_MAP.get(name)); + } + return null; + } + + /** + * Get the number of defined components. + * @return the number of defined components. + */ + public static int getComponentCount() { + return ITEM_LIST.size(); + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/MaterialsList.java b/src/main/java/Ic2ExpReactorPlanner/MaterialsList.java new file mode 100644 index 0000000000..e798f2d44f --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/MaterialsList.java @@ -0,0 +1,302 @@ +package Ic2ExpReactorPlanner; + +import static Ic2ExpReactorPlanner.BundleHelper.getI18n; +import Ic2ExpReactorPlanner.components.ReactorItem; +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedMap; +import java.util.SortedSet; +import java.util.TreeMap; +import java.util.TreeSet; + +/** + * Represents a list of materials (such as for an IndustrialCraft2 Nuclear Reactor and components). + * @author Brian McCloud + */ +public final class MaterialsList { + + private final SortedMap materials = new TreeMap<>(); + + private static boolean useGTRecipes = false; + private static boolean useUfcForCoolantCells = false; + private static boolean expandAdvancedAlloy = false; + private static String gtVersion = "none"; + + // pre-load localized material names as constants to make code more readable. + public static final String ALUMINIUM = getI18n("MaterialName.Aluminium"); + public static final String BERYLLIUM = getI18n("MaterialName.Beryllium"); + public static final String BRONZE = getI18n("MaterialName.Bronze"); + public static final String CALLISTOICEDUST = getI18n("MaterialName.CallistoIceDust"); + public static final String CESIUM = getI18n("MaterialName.CesiumFuel"); + public static final String COAL = getI18n("MaterialName.Coal"); + public static final String COAXIUM = getI18n("MaterialName.CoaxiumFuel"); + public static final String COPPER = getI18n("MaterialName.Copper"); + public static final String DIAMOND = getI18n("MaterialName.Diamond"); + public static final String DISTILLED_WATER = getI18n("MaterialName.DistilledWater"); + // Since GT 5.09 allows different materials for making the "empty cell" (steel, tin, or PTFE), it is treated as a primitive material for GT recipes instead of a crafted item that can be further broken down. + public static final String EMPTY_CELL = getI18n("MaterialName.EmptyCell"); + public static final String ENRICHEDNAQUADAH = getI18n("MaterialName.EnrichedNaquadah"); + public static final String FLUXEDELECTRUM = getI18n("MaterialName.FluxedElectrum");//too long + public static final String GOLD = getI18n("MaterialName.Gold"); + public static final String GRAPHITE = getI18n("MaterialName.Graphite"); + public static final String GLASS = getI18n("MaterialName.Glass"); + public static final String GLOWSTONE = getI18n("MaterialName.GlowstoneDust"); + public static final String HELIUM = getI18n("MaterialName.Helium"); + public static final String IRIDIUM = getI18n("MaterialName.Iridium"); + public static final String IRON = getI18n("MaterialName.Iron"); + public static final String LAPIS = getI18n("MaterialName.LapisLazuli"); + public static final String LEAD = getI18n("MaterialName.Lead"); + public static final String LEDOXDUST = getI18n("MaterialName.LedoxDust"); + public static final String MOX = getI18n("MaterialName.MoxFuel"); + public static final String NAQUADRIA = getI18n("MaterialName.Naquadria"); + public static final String PLATINUM = getI18n("MaterialName.Platinum"); + public static final String POTASSIUM = getI18n("MaterialName.Potassium"); + public static final String REDSTONE = getI18n("MaterialName.Redstone"); + public static final String REINFORCEDGLASS = getI18n("MaterialName.ReinforcedGlass");//alt recipes + public static final String RUBBER = getI18n("MaterialName.Rubber"); + public static final String SODIUM = getI18n("MaterialName.Sodium"); + public static final String THORIUM = getI18n("MaterialName.Thorium"); + public static final String TIBERIUM = getI18n("MaterialName.Tiberium"); + public static final String TIN = getI18n("MaterialName.Tin"); + public static final String TUNGSTEN = getI18n("MaterialName.Tungsten"); + public static final String URANIUM = getI18n("MaterialName.UraniumFuel"); + + // Special materials lists for items that may expand differently. + public static MaterialsList basicCircuit = new MaterialsList(IRON, 2, REDSTONE, 2, COPPER, 6, RUBBER); + public static MaterialsList advancedCircuit = new MaterialsList(basicCircuit, 4, REDSTONE, 2, LAPIS, 2, GLOWSTONE); + public static MaterialsList alloy = new MaterialsList(getI18n("MaterialName.AdvancedAlloy")); + public static MaterialsList coolantCell = new MaterialsList(1.0 / 3, TIN, DISTILLED_WATER, LAPIS); + public static MaterialsList iridiumPlate = new MaterialsList(4, IRIDIUM, 4, alloy, DIAMOND); + + // some materials lists for crafted items that are part of reactor components without themselves being reactor components. + public static final MaterialsList TIN_ITEM_CASING = new MaterialsList(0.5, TIN); + public static final MaterialsList COIL = new MaterialsList(IRON, 8.0 / 3, COPPER); + public static final MaterialsList ELECTRIC_MOTOR = new MaterialsList(IRON, 2, COIL, 2, TIN_ITEM_CASING); + public static final MaterialsList IRON_BARS = new MaterialsList(6.0 / 16, IRON); + public static final MaterialsList GLASS_PANE = new MaterialsList(6.0 / 16, GLASS); + public static final MaterialsList TIN_ALLOY = new MaterialsList(0.5, TIN, 0.5, IRON); + + + private static Map componentMaterialsMap = buildComponentMaterialsMap(); + + /** + * Creates an empty materials list. + */ + public MaterialsList() { + // fields are initialized when declared, so no code is needed in this constructor. + } + + /** + * Creates a materials list with the specified items in it. + * @param materials the materials to add, which can be strings that each represent a single material or other MaterialsList objects, and either can be preceded by a number as a count. + * @throws IllegalArgumentException if other object types are passed as arguments. + */ + public MaterialsList(Object... materials) { + add(materials); + } + + /** + * Adds the specified items to this materials list. + * @param materials the materials to add, which can be strings that each represent a single material or other MaterialsList objects, and either can be preceded by a number as a count. + * @throws IllegalArgumentException if other object types are passed as arguments. + */ + public void add(Object... materials) { + double itemCount = 1; + for (Object material : materials) { + if (material instanceof String) { + final String materialName = (String)material; + if (this.materials.containsKey(materialName)) { + this.materials.put(materialName, this.materials.get(materialName) + itemCount); + } else { + this.materials.put(materialName, itemCount); + } + itemCount = 1; + } else if (material instanceof Number) { + itemCount = ((Number)material).doubleValue(); + } else if (material instanceof MaterialsList) { + for (Map.Entry entrySet : ((MaterialsList)material).materials.entrySet()) { + if (this.materials.containsKey(entrySet.getKey())) { + this.materials.put(entrySet.getKey(), this.materials.get(entrySet.getKey()) + itemCount * entrySet.getValue()); + } else { + this.materials.put(entrySet.getKey(), itemCount * entrySet.getValue()); + } + } + itemCount = 1; + } else { + throw new IllegalArgumentException("Invalid material type: " + material.getClass().getName()); + } + } + } + + @Override + public String toString() { + StringBuilder result = new StringBuilder(1000); + DecimalFormat materialDecimalFormat = new DecimalFormat(getI18n("UI.MaterialDecimalFormat")); + for (Map.Entry entrySet : materials.entrySet()) { + double count = entrySet.getValue(); + String formattedNumber = materialDecimalFormat.format(count); + result.append(String.format("%s %s\n", formattedNumber, entrySet.getKey())); //NOI18N + } + return result.toString(); + } + + public String buildComparisonString(MaterialsList rhs, boolean alwaysDiff) { + StringBuilder result = new StringBuilder(1000); + SortedSet keys = new TreeSet<>(materials.keySet()); + keys.addAll(rhs.materials.keySet()); + DecimalFormat comparisonDecimalFormat = new DecimalFormat(getI18n("Comparison.CompareDecimalFormat")); + DecimalFormat simpleDecimalFormat = new DecimalFormat(getI18n("Comparison.SimpleDecimalFormat")); + for (String key : keys) { + double left = 0; + if (materials.containsKey(key)) { + left = materials.get(key); + } + double right = 0; + if (rhs.materials.containsKey(key)) { + right = rhs.materials.get(key); + } + String color = "orange"; + if (left < right) { + color = "green"; + } else if (left > right) { + color = "red"; + } + if (alwaysDiff || left != right) { + result.append(String.format(getI18n("Comparison.MaterialsEntry"), color, + comparisonDecimalFormat.format(left - right), key, + simpleDecimalFormat.format(left), + simpleDecimalFormat.format(right))); + } + } + return result.toString(); + } + + public static void setUseUfcForCoolantCells(boolean value) { + useUfcForCoolantCells = value; + if (value) { + coolantCell = new MaterialsList(4, TIN_ITEM_CASING, GLASS_PANE, DISTILLED_WATER, LAPIS); + } else { + coolantCell = new MaterialsList(1.0 / 3, TIN, DISTILLED_WATER, LAPIS); + } + componentMaterialsMap = buildComponentMaterialsMap(); + } + + public static void setExpandAdvancedAlloy(boolean value) { + expandAdvancedAlloy = value; + if (value) { + alloy = new MaterialsList(3.0 / 2, IRON, 3.0 / 2, BRONZE, 3.0 / 2, TIN); + } else { + alloy = new MaterialsList(getI18n("MaterialName.AdvancedAlloy")); + } + iridiumPlate = new MaterialsList(4, IRIDIUM, 4, alloy, DIAMOND); + componentMaterialsMap = buildComponentMaterialsMap(); + } + + public static void setGTVersion(String value) { + gtVersion = value; + if ("5.08".equals(value) || "5.09".equals(value)) { + coolantCell = new MaterialsList(EMPTY_CELL, DISTILLED_WATER, LAPIS); + alloy = new MaterialsList(getI18n("MaterialName.AdvancedAlloy")); + basicCircuit = new MaterialsList(getI18n("MaterialName.BasicCircuit")); + advancedCircuit = new MaterialsList(getI18n("MaterialName.AdvancedCircuit")); + } else { + basicCircuit = new MaterialsList(IRON, 2, REDSTONE, 2, COPPER, 6, RUBBER); + advancedCircuit = new MaterialsList(basicCircuit, 4, REDSTONE, 2, LAPIS, 2, GLOWSTONE); + if (useUfcForCoolantCells) { + coolantCell = new MaterialsList(4, TIN_ITEM_CASING, GLASS_PANE, DISTILLED_WATER, LAPIS); + } else { + coolantCell = new MaterialsList(1.0 / 3, TIN, DISTILLED_WATER, LAPIS); + } + if (expandAdvancedAlloy) { + alloy = new MaterialsList(3.0 / 2, IRON, 3.0 / 2, BRONZE, 3.0 / 2, TIN); + } else { + alloy = new MaterialsList(getI18n("MaterialName.AdvancedAlloy")); + } + } + iridiumPlate = new MaterialsList(4, IRIDIUM, 4, alloy, DIAMOND); + componentMaterialsMap = buildComponentMaterialsMap(); + } + + public static MaterialsList getMaterialsForComponent(ReactorItem component) { + return componentMaterialsMap.get(component.baseName); + } + + private static Map buildComponentMaterialsMap() { + Map result = new HashMap<>(63);//result.put+2? Added 14, but I can't really tell if that's right + result.put("fuelRodUranium", new MaterialsList(IRON, URANIUM)); + result.put("dualFuelRodUranium", new MaterialsList(IRON, 2, result.get("fuelRodUranium"))); + result.put("quadFuelRodUranium", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodUranium"))); + result.put("fuelRodMox", new MaterialsList(IRON, MOX)); + result.put("dualFuelRodMox", new MaterialsList(IRON, 2, result.get("fuelRodMox"))); + result.put("quadFuelRodMox", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodMox"))); + if ("5.09".equals(gtVersion)) { + result.put("neutronReflector", new MaterialsList(6, TIN_ALLOY, 2, GRAPHITE, BERYLLIUM)); + result.put("thickNeutronReflector", new MaterialsList(4, result.get("neutronReflector"), 2, BERYLLIUM)); + } else { + result.put("neutronReflector", new MaterialsList(COPPER, 4, TIN, 4, COAL)); + result.put("thickNeutronReflector", new MaterialsList(4, result.get("neutronReflector"), 5, COPPER)); + } + if ("5.08".equals(gtVersion) || "5.09".equals(gtVersion)) { + result.put("heatVent", new MaterialsList(4, ALUMINIUM, 4, IRON_BARS)); + } else { + result.put("heatVent", new MaterialsList(ELECTRIC_MOTOR, 4, IRON, 4, IRON_BARS)); + } + result.put("advancedHeatVent", new MaterialsList(2, result.get("heatVent"), 6, IRON_BARS, DIAMOND)); + result.put("reactorHeatVent", new MaterialsList(result.get("heatVent"), 8, COPPER)); + result.put("componentHeatVent", new MaterialsList(result.get("heatVent"), 4, TIN, 4, IRON_BARS)); + result.put("overclockedHeatVent", new MaterialsList(result.get("reactorHeatVent"), 4, GOLD)); + result.put("coolantCell10k", new MaterialsList(coolantCell, 4, TIN)); + result.put("coolantCell30k", new MaterialsList(3, result.get("coolantCell10k"), 6, TIN)); + result.put("coolantCell60k", new MaterialsList(2, result.get("coolantCell30k"), 6, TIN, IRON)); + result.put("heatExchanger", new MaterialsList(basicCircuit, 3, TIN, 5, COPPER)); + result.put("advancedHeatExchanger", new MaterialsList(2, result.get("heatExchanger"), 2, basicCircuit, COPPER, 4, LAPIS)); + result.put("coreHeatExchanger", new MaterialsList(result.get("heatExchanger"), 8, COPPER)); + result.put("componentHeatExchanger", new MaterialsList(result.get("heatExchanger"), 4, GOLD)); + result.put("reactorPlating", new MaterialsList(LEAD, alloy)); + result.put("heatCapacityReactorPlating", new MaterialsList(result.get("reactorPlating"), 8, COPPER)); + if ("5.08".equals(gtVersion) || "5.09".equals(gtVersion)) { + result.put("containmentReactorPlating", new MaterialsList(result.get("reactorPlating"), LEAD)); + } else { + result.put("containmentReactorPlating", new MaterialsList(result.get("reactorPlating"), 2, alloy)); + } + result.put("rshCondensator", new MaterialsList(result.get("heatVent"), result.get("heatExchanger"), 7, REDSTONE)); + result.put("lzhCondensator", new MaterialsList(2, result.get("rshCondensator"), result.get("reactorHeatVent"), result.get("coreHeatExchanger"), 9, LAPIS, 4, REDSTONE)); + result.put("fuelRodThorium", new MaterialsList(IRON, 3, THORIUM)); + result.put("dualFuelRodThorium", new MaterialsList(IRON, 2, result.get("fuelRodThorium"))); + result.put("quadFuelRodThorium", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodThorium"))); + result.put("coolantCellHelium60k", new MaterialsList(EMPTY_CELL, HELIUM, 4, TIN)); + result.put("coolantCellHelium180k", new MaterialsList(3, result.get("coolantCellHelium60k"), 6, TIN)); + result.put("coolantCellHelium360k", new MaterialsList(2, result.get("coolantCellHelium180k"), 6, TIN, 9, COPPER)); + result.put("coolantCellNak60k", new MaterialsList(result.get("coolantCell10k"), 4, TIN, 2, POTASSIUM, 2, SODIUM)); + result.put("coolantCellNak180k", new MaterialsList(3, result.get("coolantCellNak60k"), 6, TIN)); + result.put("coolantCellNak360k", new MaterialsList(2, result.get("coolantCellNak180k"), 6, TIN, 9, COPPER)); + result.put("iridiumNeutronReflector", new MaterialsList(6, result.get("thickNeutronReflector"), 18, COPPER, iridiumPlate)); + result.put("fuelRodNaquadah", new MaterialsList(IRON, 3, ENRICHEDNAQUADAH)); + result.put("dualFuelRodNaquadah", new MaterialsList(IRON, 2, result.get("fuelRodNaquadah"))); + result.put("quadFuelRodNaquadah", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodNaquadah"))); + result.put("fuelRodCoaxium", new MaterialsList(4, IRIDIUM, 36, DIAMOND, 3, COAXIUM)); + result.put("dualFuelRodCoaxium", new MaterialsList(IRON, 2, result.get("fuelRodCoaxium"))); + result.put("quadFuelRodCoaxium", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodCoaxium"))); + result.put("fuelRodCesium", new MaterialsList(IRON, 3, CESIUM)); + result.put("dualFuelRodCesium", new MaterialsList(IRON, 2, result.get("fuelRodCesium"))); + result.put("quadFuelRodCesium", new MaterialsList(3, IRON, 2, COPPER, 4, result.get("fuelRodCesium"))); + result.put("fuelRodNaquadahGTNH", new MaterialsList(4, IRON, 4, TUNGSTEN, 1, PLATINUM, 3, ENRICHEDNAQUADAH)); + result.put("dualFuelRodNaquadahGTNH", new MaterialsList(IRON, TUNGSTEN, 2, result.get("fuelRodNaquadahGTNH"))); + result.put("quadFuelRodNaquadahGTNH", new MaterialsList(3, IRON, 3, TUNGSTEN, 4, result.get("fuelRodNaquadahGTNH"))); + result.put("fuelRodNaquadria", new MaterialsList(4, IRON, 4, TUNGSTEN, 1, PLATINUM, 3, NAQUADRIA)); + result.put("dualFuelRodNaquadria", new MaterialsList(IRON, TUNGSTEN, 2, result.get("fuelRodNaquadria"))); + result.put("quadFuelRodNaquadria", new MaterialsList(3, IRON, 3, TUNGSTEN, 4, result.get("fuelRodNaquadria"))); + result.put("fuelRodTiberium", new MaterialsList(4, IRON, 4, TUNGSTEN, 1, PLATINUM, 3, TIBERIUM)); + result.put("dualFuelRodTiberium", new MaterialsList(IRON, TUNGSTEN, 2, result.get("fuelRodTiberium"))); + result.put("quadFuelRodTiberium", new MaterialsList(3, IRON, 3, TUNGSTEN, 4, result.get("fuelRodTiberium"))); + result.put("fuelRodTheCore", new MaterialsList(96, IRON, 96, TUNGSTEN, 128, TIBERIUM, 32, result.get("fuelRodNaquadah"))); + result.put("coolantCellSpace180k", new MaterialsList(0.5, CALLISTOICEDUST, 0.5, LEDOXDUST, 1000, DISTILLED_WATER, LAPIS, REINFORCEDGLASS, 2, IRON, 2, TUNGSTEN)); + result.put("coolantCellSpace360k", new MaterialsList(1.5, IRON, 1.5, TUNGSTEN, 2, result.get("coolantCellSpace180k"))); + result.put("coolantCellSpace540k", new MaterialsList(3, IRON, 3, TUNGSTEN, 3, result.get("coolantCellSpace180k"))); + result.put("coolantCellSpace1080k", new MaterialsList(3, IRON, 3, TUNGSTEN, 9, FLUXEDELECTRUM, 3, result.get("coolantCellSpace540k"))); + + return result; + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/Reactor.java b/src/main/java/Ic2ExpReactorPlanner/Reactor.java new file mode 100644 index 0000000000..e611189317 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/Reactor.java @@ -0,0 +1,763 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner; + +import static Ic2ExpReactorPlanner.BundleHelper.formatI18n; +import static Ic2ExpReactorPlanner.BundleHelper.getI18n; +import Ic2ExpReactorPlanner.components.ReactorItem; +import java.awt.HeadlessException; +import javax.swing.JOptionPane; + +/** + * Represents an IndustrialCraft2 Nuclear Reactor. + * @author Brian McCloud + */ +public class Reactor { + + private final ReactorItem[][] grid = new ReactorItem[6][9]; + + private double currentEUoutput = 0.0; + + private double currentHeat = 0.0; + + private double maxHeat = 10000.0; + + private double ventedHeat = 0.0; + + private boolean fluid = false; + + private boolean pulsed = false; + + private boolean automated = false; + + private boolean usingReactorCoolantInjectors = false; + + private static final int DEFAULT_ON_PULSE = (int)5e6; + + private int onPulse = DEFAULT_ON_PULSE; + + private static final int DEFAULT_OFF_PULSE = 0; + + private int offPulse = DEFAULT_OFF_PULSE; + + private static final int DEFAULT_SUSPEND_TEMP = (int)120e3; + + private int suspendTemp = DEFAULT_SUSPEND_TEMP; + + private static final int DEFAULT_RESUME_TEMP = (int)120e3; + + private int resumeTemp = DEFAULT_RESUME_TEMP; + + private int maxSimulationTicks = (int)5e6; + + // maximum paramatter types for a reactor component (current initial heat, automation threshold, reactor pause + private static final int MAX_PARAM_TYPES = 3; + + public static final int MAX_COMPONENT_HEAT = 1_080_000; + + public ReactorItem getComponentAt(final int row, final int column) { + if (row >= 0 && row < grid.length && column >= 0 && column < grid[row].length) { + return grid[row][column]; + } + return null; + } + + public void setComponentAt(final int row, final int column, final ReactorItem component) { + if (row >= 0 && row < grid.length && column >= 0 && column < grid[row].length) { + if (grid[row][column] != null) { + grid[row][column].removeFromReactor(); + } + grid[row][column] = component; + if (component != null) { + component.addToReactor(this, row, column); + } + } + } + + public void clearGrid() { + for (int row = 0; row < grid.length; row++) { + for (int col = 0; col < grid[row].length; col++) { + setComponentAt(row, col, null); + } + } + } + + /** + * @return the amount of EU output in the reactor tick just simulated. + */ + public double getCurrentEUoutput() { + return currentEUoutput; + } + + /** + * @return the current heat level of the reactor. + */ + public double getCurrentHeat() { + return currentHeat; + } + + /** + * @return the maximum heat of the reactor. + */ + public double getMaxHeat() { + return maxHeat; + } + + /** + * Adjust the maximum heat + * @param adjustment the adjustment amount (negative values decrease the max heat). + */ + public void adjustMaxHeat(final double adjustment) { + maxHeat += adjustment; + } + + /** + * Set the current heat of the reactor. Mainly to be used for simulating a pre-heated reactor, or for resetting to 0 for a new simulation. + * @param currentHeat the heat to set + */ + public void setCurrentHeat(final double currentHeat) { + this.currentHeat = currentHeat; + } + + /** + * Adjusts the reactor's current heat by a specified amount + * @param adjustment the adjustment amount. + */ + public void adjustCurrentHeat(final double adjustment) { + currentHeat += adjustment; + if (currentHeat < 0.0) { + currentHeat = 0.0; + } + } + + /** + * add some EU output. + * @param amount the amount of EU to output over 1 reactor tick (20 game ticks). + */ + public void addEUOutput(final double amount) { + currentEUoutput += amount; + } + + /** + * clears the EU output (presumably to start simulating a new reactor tick). + */ + public void clearEUOutput() { + currentEUoutput = 0.0; + } + + /** + * Gets a list of the materials needed to build the components. + * @return a list of the materials needed to build the components. + */ + public MaterialsList getMaterials() { + MaterialsList result = new MaterialsList(); + for (int col = 0; col < grid[0].length; col++) { + for (int row = 0; row < grid.length; row++) { + if (getComponentAt(row, col) != null) { + result.add(MaterialsList.getMaterialsForComponent(getComponentAt(row, col))); + } + } + } + return result; + } + + public MaterialsList getComponentList() { + MaterialsList result = new MaterialsList(); + for (int col = 0; col < grid[0].length; col++) { + for (int row = 0; row < grid.length; row++) { + if (getComponentAt(row, col) != null) { + result.add(getComponentAt(row, col).name); + } + } + } + return result; + } + + /** + * @return the amount of heat vented this reactor tick. + */ + public double getVentedHeat() { + return ventedHeat; + } + + /** + * Adds to the amount of heat vented this reactor tick, in case it is a new-style reactor with a pressure vessel and outputting heat to fluid instead of EU. + * @param amount the amount to add. + */ + public void ventHeat(final double amount) { + ventedHeat += amount; + } + + /** + * Clears the amount of vented heat, in case a new reactor tick is starting. + */ + public void clearVentedHeat() { + ventedHeat = 0; + } + + /** + * Get a code that represents the component set, which can be passed between forum users, etc. + * @return a code representing some ids for the components and arrangement. Passing the same code to setCode() should re-create an identical reactor setup, even if other changes have happened in the meantime. + */ + public String getCode() { + return "erp=" + buildCodeString(); + } + + /** + * Sets a code to configure the entire grid all at once. Expects the code to have originally been output by getCode(). + * @param code the code of the reactor setup to use. + */ + public void setCode(final String code) { + int pos = 0; + int[][] ids = new int[grid.length][grid[0].length]; + char[][][] paramTypes = new char[grid.length][grid[0].length][MAX_PARAM_TYPES]; + int[][][] params = new int[grid.length][grid[0].length][MAX_PARAM_TYPES]; + if (code.startsWith("erp=")) { + readCodeString(code.substring(4)); + } else if (code.length() >= 108 && code.matches("[0-9A-Za-z(),|]+")) { //NOI18N + try { + for (int row = 0; row < grid.length; row++) { + for (int col = 0; col < grid[row].length; col++) { + ids[row][col] = Integer.parseInt(code.substring(pos, pos + 2), 16); + pos += 2; + int paramNum = 0; + if (pos + 1 < code.length() && code.charAt(pos) == '(') { + paramTypes[row][col][paramNum] = code.charAt(pos + 1); + int tempPos = pos + 2; + StringBuilder param = new StringBuilder(10); + while (tempPos < code.length() && code.charAt(tempPos) != ')') { + if (code.charAt(tempPos) == ',') { + params[row][col][paramNum] = Integer.parseInt(param.toString(), 36); + paramNum++; + if (tempPos + 1 < code.length()) { + tempPos++; + paramTypes[row][col][paramNum] = code.charAt(tempPos); + } + param.setLength(0); + } else { + param.append(code.charAt(tempPos)); + } + tempPos++; + } + params[row][col][paramNum] = Integer.parseInt(param.toString(), 36); + pos = tempPos + 1; + } + } + } + for (int row = 0; row < grid.length; row++) { + for (int col = 0; col < grid[row].length; col++) { + final ReactorItem component = ComponentFactory.createComponent(ids[row][col]); + for (int paramNum = 0; paramNum < MAX_PARAM_TYPES; paramNum++) { + switch (paramTypes[row][col][paramNum]) { + case 'h': + component.setInitialHeat(params[row][col][paramNum]); + break; + case 'a': + component.setAutomationThreshold(params[row][col][paramNum]); + break; + case 'p': + component.setReactorPause(params[row][col][paramNum]); + break; + default: + break; + } + } + setComponentAt(row, col, component); + } + } + if (code.split("\\|").length > 1) { + String extraCode = code.split("\\|")[1]; + switch (extraCode.charAt(0)) { + case 'f': + fluid = true; + break; + case 'e': + fluid = false; + break; + default: + break; + } + switch (extraCode.charAt(1)) { + case 's': + pulsed = false; + automated = false; + break; + case 'p': + pulsed = true; + automated = false; + break; + case 'a': + pulsed = true; + automated = true; + break; + default: + break; + } + switch (extraCode.charAt(2)) { + case 'i': + usingReactorCoolantInjectors = true; + break; + case 'n': + usingReactorCoolantInjectors = false; + break; + default: + break; + } + if (extraCode.length() > 3) { + currentHeat = Integer.parseInt(extraCode.substring(3), 36); + } else { + currentHeat = 0; + } + } + if (code.split("\\|").length > 2) { + String[] moreCodes = code.split("\\|"); + for (int i = 2; i < moreCodes.length; i++) { + switch (moreCodes[i].charAt(0)) { + case 'n': + onPulse = Integer.parseInt(moreCodes[i].substring(1), 36); + break; + case 'f': + offPulse = Integer.parseInt(moreCodes[i].substring(1), 36); + break; + case 's': + suspendTemp = Integer.parseInt(moreCodes[i].substring(1), 36); + break; + case 'r': + resumeTemp = Integer.parseInt(moreCodes[i].substring(1), 36); + break; + default: + break; + } + } + } + } catch (NumberFormatException e) { + e.printStackTrace(); + } + } else { + String tempCode = code; + if (code.startsWith("http://www.talonfiremage.pwp.blueyonder.co.uk/v3/reactorplanner.html?")) { //NOI18N + tempCode = code.replace("http://www.talonfiremage.pwp.blueyonder.co.uk/v3/reactorplanner.html?", ""); //NOI18N + } + if (tempCode.matches("[0-9a-z]+")) { //NOI18N + // Possibly a code from Talonius's old planner + handleTaloniusCode(tempCode); + } else if (code.matches("[0-9A-Za-z+/=]+")) { //NOI18N + // Try to handle it as a newer code with the "erp=" prefix stripped + readCodeString(code); + } else if (!code.isEmpty()) { + JOptionPane.showMessageDialog(null, String.format(getI18n("Warning.InvalidReactorCode"), code), getI18n("Warning.Title"), JOptionPane.WARNING_MESSAGE); + } + } + } + + private void handleTaloniusCode(String tempCode) throws HeadlessException { + StringBuilder warnings = new StringBuilder(500); + TaloniusDecoder decoder = new TaloniusDecoder(tempCode); + // initial heat, in multiples of 100 + currentHeat = 100 * decoder.readInt(10); + // reactor grid + for (int x = 8; x >= 0; x--) { + for (int y = 5; y >= 0; y--) { + int nextValue = decoder.readInt(7); + + // items are no longer stackable in IC2 reactors, but stack sizes from the planner code still need to be handled + if (nextValue > 64) { + nextValue = decoder.readInt(7); + } + + switch (nextValue) { + case 0: + setComponentAt(y, x, null); + break; + case 1: + setComponentAt(y, x, ComponentFactory.createComponent("fuelRodUranium")); + break; + case 2: + setComponentAt(y, x, ComponentFactory.createComponent("dualFuelRodUranium")); + break; + case 3: + setComponentAt(y, x, ComponentFactory.createComponent("quadFuelRodUranium")); + break; + case 4: + warnings.append(formatI18n("Warning.DepletedIsotope", y, x)); + break; + case 5: + setComponentAt(y, x, ComponentFactory.createComponent("neutronReflector")); + break; + case 6: + setComponentAt(y, x, ComponentFactory.createComponent("thickNeutronReflector")); + break; + case 7: + setComponentAt(y, x, ComponentFactory.createComponent("heatVent")); + break; + case 8: + setComponentAt(y, x, ComponentFactory.createComponent("reactorHeatVent")); + break; + case 9: + setComponentAt(y, x, ComponentFactory.createComponent("overclockedHeatVent")); + break; + case 10: + setComponentAt(y, x, ComponentFactory.createComponent("advancedHeatVent")); + break; + case 11: + setComponentAt(y, x, ComponentFactory.createComponent("componentHeatVent")); + break; + case 12: + setComponentAt(y, x, ComponentFactory.createComponent("rshCondensator")); + break; + case 13: + setComponentAt(y, x, ComponentFactory.createComponent("lzhCondensator")); + break; + case 14: + setComponentAt(y, x, ComponentFactory.createComponent("heatExchanger")); + break; + case 15: + setComponentAt(y, x, ComponentFactory.createComponent("coreHeatExchanger")); + break; + case 16: + setComponentAt(y, x, ComponentFactory.createComponent("componentHeatExchanger")); + break; + case 17: + setComponentAt(y, x, ComponentFactory.createComponent("advancedHeatExchanger")); + break; + case 18: + setComponentAt(y, x, ComponentFactory.createComponent("reactorPlating")); + break; + case 19: + setComponentAt(y, x, ComponentFactory.createComponent("heatCapacityReactorPlating")); + break; + case 20: + setComponentAt(y, x, ComponentFactory.createComponent("containmentReactorPlating")); + break; + case 21: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCell10k")); + break; + case 22: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCell30k")); + break; + case 23: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCell60k")); + break; + case 24: + warnings.append(formatI18n("Warning.Heating", y, x)); + break; + case 32: + setComponentAt(y, x, ComponentFactory.createComponent("fuelRodThorium")); + break; + case 33: + setComponentAt(y, x, ComponentFactory.createComponent("dualFuelRodThorium")); + break; + case 34: + setComponentAt(y, x, ComponentFactory.createComponent("quadFuelRodThorium")); + break; + case 35: + warnings.append(formatI18n("Warning.Plutonium", y, x)); + break; + case 36: + warnings.append(formatI18n("Warning.DualPlutonium", y, x)); + break; + case 37: + warnings.append(formatI18n("Warning.QuadPlutonium", y, x)); + break; + case 38: + setComponentAt(y, x, ComponentFactory.createComponent("iridiumNeutronReflector")); + break; + case 39: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellHelium60k")); + break; + case 40: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellHelium180k")); + break; + case 41: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellHelium360k")); + break; + case 42: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellNak60k")); + break; + case 43: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellNak180k")); + break; + case 44: + setComponentAt(y, x, ComponentFactory.createComponent("coolantCellNak360k")); + break; + default: + warnings.append(formatI18n("Warning.Unrecognized", nextValue, y, x)); + break; + } + } + } + if (warnings.length() > 0) { + warnings.setLength(warnings.length() - 1); // to remove last newline character + JOptionPane.showMessageDialog(null, warnings, getI18n("Warning.Title"), JOptionPane.WARNING_MESSAGE); + } + } + + // reads a Base64 code string for the reactor, after stripping the prefix. + private void readCodeString(final String code) { + BigintStorage storage = BigintStorage.inputBase64(code); + // read the code revision from the code itself instead of making it part of the prefix. + int codeRevision = storage.extract(255); + int maxComponentHeat; + if (codeRevision == 3) + maxComponentHeat = (int)1080e3; + else + maxComponentHeat = (int)360e3; + // Check if the code revision is supported yet. + if (codeRevision > 3) { + throw new IllegalArgumentException("Unsupported code revision in reactor code."); + } + // for code revision 1 or newer, read whether the reactor is pulsed and/or automated next. + if (codeRevision >= 1) { + pulsed = storage.extract(1) > 0; + automated = storage.extract(1) > 0; + } + // read the grid next + for (int row = 0; row < grid.length; row++) { + for (int col = 0; col < grid[row].length; col++) { + int componentId = 0; + // Changes may be coming to the number of components available, so make sure to check the code revision number. + if (codeRevision <= 1) { + componentId = storage.extract(38); + } else if (codeRevision == 2) { + componentId = storage.extract(44); + } else { + componentId = storage.extract(58); + } + if (componentId != 0) { + ReactorItem component = ComponentFactory.createComponent(componentId); + int hasSpecialAutomationConfig = storage.extract(1); + if (hasSpecialAutomationConfig > 0) { + component.setInitialHeat(storage.extract(maxComponentHeat)); + if (codeRevision == 0 || (codeRevision >= 1 && automated)) { + component.setAutomationThreshold(storage.extract(maxComponentHeat)); + component.setReactorPause(storage.extract((int)10e3)); + } + } + setComponentAt(row, col, component); + } else { + setComponentAt(row, col, null); + } + } + } + // next, read the inital temperature and other details. + currentHeat = storage.extract((int)120e3); + if (codeRevision == 0 || (codeRevision >= 1 && pulsed)) { + onPulse = storage.extract((int)5e6); + offPulse = storage.extract((int)5e6); + suspendTemp = storage.extract((int)120e3); + resumeTemp = storage.extract((int)120e3); + } + fluid = storage.extract(1) > 0; + usingReactorCoolantInjectors = storage.extract(1) > 0; + if (codeRevision == 0) { + pulsed = storage.extract(1) > 0; + automated = storage.extract(1) > 0; + } + maxSimulationTicks = storage.extract((int)5e6); + } + + // builds a Base64 code string, not including the prefix. + private String buildCodeString() { + BigintStorage storage = new BigintStorage(); + // first, store the extra details, in reverse order of expected reading. + storage.store(maxSimulationTicks, (int)5e6); + storage.store(usingReactorCoolantInjectors ? 1 : 0, 1); + storage.store(fluid ? 1 : 0, 1); + if (pulsed) { + storage.store(resumeTemp, (int)120e3); + storage.store(suspendTemp, (int)120e3); + storage.store(offPulse, (int)5e6); + storage.store(onPulse, (int)5e6); + } + storage.store((int)currentHeat, (int)120e3); + // grid is read (almost) first, so written (almost) last, and in reverse order + for (int row = grid.length - 1; row >= 0; row--) { + for (int col = grid[row].length - 1; col >= 0; col--) { + ReactorItem component = grid[row][col]; + if (component != null) { + int id = component.id; + // only store automation details for a component if non-default, and add a flag bit to indicate their presence. null components don't even need the flag bit. + if (component.getInitialHeat() > 0 || component.getAutomationThreshold() != ComponentFactory.getDefaultComponent(id).getAutomationThreshold() || component.getReactorPause() != ComponentFactory.getDefaultComponent(id).getReactorPause()) { + if (automated) { + storage.store(component.getReactorPause(), (int)10e3); + storage.store(component.getAutomationThreshold(), (int)1080e3); + } + storage.store((int)component.getInitialHeat(), (int)1080e3); + storage.store(1, 1); + } else { + storage.store(0, 1); + } + storage.store(id, 58); + } else { + storage.store(0, 58); + } + } + } + storage.store(automated ? 1 : 0, 1); + storage.store(pulsed ? 1 : 0, 1); + // store the code revision, allowing values up to 255 (8 bits) before adjusting how it is stored in the code. + storage.store(3, 255); + return storage.outputBase64(); + } + + // Get an old-style (pre-2.3.1) code for the reactor, for pasting into older versions of the planner. + public String getOldCode() { + StringBuilder result = new StringBuilder(108); + for (int row = 0; row < grid.length; row++) { + for (int col = 0; col < grid[row].length; col++) { + final ReactorItem component = getComponentAt(row, col); + final int id = (component != null) ? component.id : 0; + result.append(String.format("%02X", id)); //NOI18N + if (component != null && (component.getInitialHeat() > 0 + || (automated && component.getAutomationThreshold() != ComponentFactory.getDefaultComponent(id).getAutomationThreshold()) + || (automated && component.getReactorPause() != ComponentFactory.getDefaultComponent(id).getReactorPause()))) { + result.append("("); + if (component.getInitialHeat() > 0) { + result.append(String.format("h%s,", Integer.toString((int) component.getInitialHeat(), 36))); //NOI18N + } + if (automated && component.getAutomationThreshold() != ComponentFactory.getDefaultComponent(id).getAutomationThreshold()) { + result.append(String.format("a%s,", Integer.toString(component.getAutomationThreshold(), 36))); //NOI18N + } + if (automated && component.getReactorPause() != ComponentFactory.getDefaultComponent(id).getReactorPause()) { + result.append(String.format("p%s,", Integer.toString(component.getReactorPause(), 36))); //NOI18N + } + result.setLength(result.length() - 1); // remove the last comma, whichever parameter it came from. + result.append(")"); + } + } + } + result.append('|'); + if (fluid) { + result.append('f'); + } else { + result.append('e'); + } + if (automated) { + result.append('a'); + } else if (pulsed) { + result.append('p'); + } else { + result.append('s'); + } + if (usingReactorCoolantInjectors) { + result.append('i'); + } else { + result.append('n'); + } + if (currentHeat > 0) { + result.append(Integer.toString((int) currentHeat, 36)); + } + if (pulsed && onPulse != DEFAULT_ON_PULSE) { + result.append(String.format("|n%s", Integer.toString(onPulse, 36))); + } + if (pulsed && offPulse != DEFAULT_OFF_PULSE) { + result.append(String.format("|f%s", Integer.toString(offPulse, 36))); + } + if (pulsed && suspendTemp != DEFAULT_SUSPEND_TEMP) { + result.append(String.format("|s%s", Integer.toString(suspendTemp, 36))); + } + if (pulsed && resumeTemp != DEFAULT_SUSPEND_TEMP) { + result.append(String.format("|r%s", Integer.toString(resumeTemp, 36))); + } + return result.toString(); + } + + /** + * Checks whether the reactor is to simulate a fluid-style reactor, rather than a direct EU-output reactor. + * @return true if this was set to be a fluid-style reactor, false if this was set to be direct EU-output reactor. + */ + public boolean isFluid() { + return fluid; + } + + /** + * Sets whether the reactor is to simulate a fluid-style reactor, rather than a direct EU-output reactor. + * @param fluid true if this is to be a fluid-style reactor, false if this is to be direct EU-output reactor. + */ + public void setFluid(final boolean fluid) { + this.fluid = fluid; + } + + /** + * Checks whether the reactor is using Reactor Coolant Injectors (RCIs) + * @return true if this reactor was set to use RCIs, false otherwise. + */ + public boolean isUsingReactorCoolantInjectors() { + return usingReactorCoolantInjectors; + } + + /** + * Sets whether the reactor is to use Reactor Coolant Injectors (RCIs) + * @param usingReactorCoolantInjectors true if this reactor should use RCIs, false otherwise. + */ + public void setUsingReactorCoolantInjectors(final boolean usingReactorCoolantInjectors) { + this.usingReactorCoolantInjectors = usingReactorCoolantInjectors; + } + + public int getOnPulse() { + return onPulse; + } + + public void setOnPulse(final int onPulse) { + this.onPulse = onPulse; + } + + public int getOffPulse() { + return offPulse; + } + + public void setOffPulse(final int offPulse) { + this.offPulse = offPulse; + } + + public int getSuspendTemp() { + return suspendTemp; + } + + public void setSuspendTemp(final int suspendTemp) { + this.suspendTemp = suspendTemp; + } + + public int getResumeTemp() { + return resumeTemp; + } + + public void setResumeTemp(final int resumeTemp) { + this.resumeTemp = resumeTemp; + } + + public boolean isPulsed() { + return pulsed; + } + + public void setPulsed(boolean pulsed) { + this.pulsed = pulsed; + } + + public boolean isAutomated() { + return automated; + } + + public void setAutomated(boolean automated) { + this.automated = automated; + } + + public int getMaxSimulationTicks() { + return maxSimulationTicks; + } + + public void setMaxSimulationTicks(int maxSimulationTicks) { + this.maxSimulationTicks = maxSimulationTicks; + } + + public void resetPulseConfig() { + onPulse = DEFAULT_ON_PULSE; + offPulse = DEFAULT_OFF_PULSE; + suspendTemp = DEFAULT_SUSPEND_TEMP; + resumeTemp = DEFAULT_RESUME_TEMP; + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/ReactorPlannerFrame.form b/src/main/java/Ic2ExpReactorPlanner/ReactorPlannerFrame.form new file mode 100644 index 0000000000..40e56f5d3e --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/ReactorPlannerFrame.form @@ -0,0 +1,2260 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/Ic2ExpReactorPlanner/SimulationData.java b/src/main/java/Ic2ExpReactorPlanner/SimulationData.java new file mode 100644 index 0000000000..d6384ef012 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/SimulationData.java @@ -0,0 +1,81 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner; + +/** + * Simple container for data from a simulation of an IC2 nuclear reactor, to allow comparison wtih another simulation. + * @author Brian McCloud + */ +public class SimulationData { + // Values should only be written to by the simulator class and read by other classes, but this is not yet strictly enforced. + // Enforcement might require refactoring this to be an inner class of the simulator. + + // Times to temperature thresholds + public int timeToBelow50 = Integer.MAX_VALUE; + public int timeToBurn = Integer.MAX_VALUE; + public int timeToEvaporate = Integer.MAX_VALUE; + public int timeToHurt = Integer.MAX_VALUE; + public int timeToLava = Integer.MAX_VALUE; + public int timeToXplode = Integer.MAX_VALUE; + + // Special, for calculating efficiency + public int totalRodCount = 0; + + // First component broken details + public int firstComponentBrokenTime = Integer.MAX_VALUE; + public int firstComponentBrokenRow = -1; + public int firstComponentBrokenCol = -1; + public String firstComponentBrokenDescription = ""; + public double prebreakTotalEUoutput = 0; + public double prebreakAvgEUoutput = 0; + public double prebreakMinEUoutput = Double.MAX_VALUE; + public double prebreakMaxEUoutput = 0; + public double prebreakTotalHUoutput = 0; + public double prebreakAvgHUoutput = 0; + public double prebreakMinHUoutput = Double.MAX_VALUE; + public double prebreakMaxHUoutput = 0; + + // First rod depleted details + public int firstRodDepletedTime = Integer.MAX_VALUE; + public int firstRodDepletedRow = -1; + public int firstRodDepletedCol = -1; + public String firstRodDepletedDescription = ""; + public double predepleteTotalEUoutput = 0; + public double predepleteAvgEUoutput = 0; + public double predepleteMinEUoutput = Double.MAX_VALUE; + public double predepleteMaxEUoutput = 0; + public double predepleteTotalHUoutput = 0; + public double predepleteAvgHUoutput = 0; + public double predepleteMinHUoutput = Double.MAX_VALUE; + public double predepleteMaxHUoutput = 0; + public double predepleteMinTemp = Double.MAX_VALUE; + public double predepleteMaxTemp = 0; + + // Completed-simulation details + public int totalReactorTicks = 0; + public int totalEUoutput = 0; + public int avgEUoutput = 0; + public double minEUoutput = Double.MAX_VALUE; + public int maxEUoutput = 0; + public int totalHUoutput = 0; + public int avgHUoutput = 0; + public double minHUoutput = Double.MAX_VALUE; + public int maxHUoutput = 0; + public int minTemp = (int) Double.MAX_VALUE; + public int maxTemp = 0; + public int explosionPower = 0; + + // Heating and Cooling details + public double hullHeating = 0; + public double componentHeating = 0; + public double hullCooling = 0; + public double hullCoolingCapacity = 0; + public double ventCooling = 0; + public double ventCoolingCapacity = 0; + + // Automation details + public MaterialsList replacedItems = new MaterialsList(); +} diff --git a/src/main/java/Ic2ExpReactorPlanner/TaloniusDecoder.java b/src/main/java/Ic2ExpReactorPlanner/TaloniusDecoder.java new file mode 100644 index 0000000000..89232eb007 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/TaloniusDecoder.java @@ -0,0 +1,26 @@ + +package Ic2ExpReactorPlanner; + +import java.math.BigInteger; + +/** + * Pulls values out of codes from Talonius's old reactor planner. + * @author Brian McCloud + */ +public class TaloniusDecoder { + private BigInteger dataStack = null; + + public TaloniusDecoder(final String dataCode) { + dataStack = new BigInteger(dataCode, 36); + } + + public int readInt(final int bits) { + return readBigInteger(bits).intValue(); + } + + private BigInteger readBigInteger(final int bits) { + BigInteger data = dataStack.and(BigInteger.ONE.shiftLeft(bits).subtract(BigInteger.ONE)); + dataStack = dataStack.shiftRight(bits); + return data; + } +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Condensator.java b/src/main/java/Ic2ExpReactorPlanner/components/Condensator.java new file mode 100644 index 0000000000..d38db4c704 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/Condensator.java @@ -0,0 +1,48 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents a condensator in a reactor, either RSH or LZH. + * @author Brian McCloud + */ +public class Condensator extends ReactorItem { + + public Condensator(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + } + + public Condensator(final Condensator other) { + super(other); + } + + @Override + public double adjustCurrentHeat(final double heat) { + if (heat < 0.0) { + return heat; + } + currentCondensatorCooling += heat; + bestCondensatorCooling = Math.max(currentCondensatorCooling, bestCondensatorCooling); + double acceptedHeat = Math.min(heat, getMaxHeat() - heat); + double result = heat - acceptedHeat; + currentHeat += acceptedHeat; + maxReachedHeat = Math.max(maxReachedHeat, currentHeat); + return result; + } + + @Override + public boolean needsCoolantInjected() { + return currentHeat > 0.85 * getMaxHeat(); + } + + @Override + public void injectCoolant() { + currentHeat = 0; + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/CoolantCell.java b/src/main/java/Ic2ExpReactorPlanner/components/CoolantCell.java new file mode 100644 index 0000000000..f152b49985 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/CoolantCell.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents a coolant cell in a reactor. + * @author Brian McCloud + */ +public class CoolantCell extends ReactorItem { + + public CoolantCell(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + } + + public CoolantCell(final CoolantCell other) { + super(other); + } + + @Override + public double adjustCurrentHeat(final double heat) { + currentCellCooling += heat; + bestCellCooling = Math.max(currentCellCooling, bestCellCooling); + return super.adjustCurrentHeat(heat); + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java b/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java new file mode 100644 index 0000000000..efb9a826e2 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java @@ -0,0 +1,130 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents a heat exchanger of some sort in a reactor. + * @author Brian McCloud + */ +public class Exchanger extends ReactorItem { + + private final int switchSide; + private final int switchReactor; + + public Exchanger(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod, final int switchSide, final int switchReactor) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + this.switchSide = switchSide; + this.switchReactor = switchReactor; + } + + public Exchanger(final Exchanger other) { + super(other); + this.switchSide = other.switchSide; + this.switchReactor = other.switchReactor; + } + + @Override + public void transfer() { + List heatableNeighbors = new ArrayList<>(4); + ReactorItem component = parent.getComponentAt(row, col - 1); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row, col + 1); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row - 1, col); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row + 1, col); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + // Code adapted from decompiled IC2 code, class ItemReactorHeatSwitch, with permission from Thunderdark. + double myHeat = 0; + if (switchSide > 0) { + for (ReactorItem heatableNeighbor : heatableNeighbors) { + double mymed = getCurrentHeat() * 100.0 / getMaxHeat(); + double heatablemed = heatableNeighbor.getCurrentHeat() * 100.0 / heatableNeighbor.getMaxHeat(); + + double add = (int) (heatableNeighbor.getMaxHeat() / 100.0 * (heatablemed + mymed / 2.0)); + if (add > switchSide) { + add = switchSide; + } + if (heatablemed + mymed / 2.0 < 1.0) { + add = switchSide / 2; + } + if (heatablemed + mymed / 2.0 < 0.75) { + add = switchSide / 4; + } + if (heatablemed + mymed / 2.0 < 0.5) { + add = switchSide / 8; + } + if (heatablemed + mymed / 2.0 < 0.25) { + add = 1; + } + if (Math.round(heatablemed * 10.0) / 10.0 > Math.round(mymed * 10.0) / 10.0) { + add -= 2 * add; + } else if (Math.round(heatablemed * 10.0) / 10.0 == Math.round(mymed * 10.0) / 10.0) { + add = 0; + } + myHeat -= add; + if (add > 0) { + currentComponentHeating += add; + } + add = heatableNeighbor.adjustCurrentHeat(add); + myHeat += add; + } + } + if (switchReactor > 0) { + double mymed = getCurrentHeat() * 100.0 / getMaxHeat(); + double Reactormed = parent.getCurrentHeat() * 100.0 / parent.getMaxHeat(); + + int add = (int) Math.round(parent.getMaxHeat() / 100.0 * (Reactormed + mymed / 2.0)); + if (add > switchReactor) { + add = switchReactor; + } + if (Reactormed + mymed / 2.0 < 1.0) { + add = switchSide / 2; + } + if (Reactormed + mymed / 2.0 < 0.75) { + add = switchSide / 4; + } + if (Reactormed + mymed / 2.0 < 0.5) { + add = switchSide / 8; + } + if (Reactormed + mymed / 2.0 < 0.25) { + add = 1; + } + if (Math.round(Reactormed * 10.0) / 10.0 > Math.round(mymed * 10.0) / 10.0) { + add -= 2 * add; + } else if (Math.round(Reactormed * 10.0) / 10.0 == Math.round(mymed * 10.0) / 10.0) { + add = 0; + } + myHeat -= add; + parent.adjustCurrentHeat(add); + if (add > 0) { + currentHullHeating = add; + } else { + currentHullCooling = -add; + } + } + adjustCurrentHeat(myHeat); + } + + @Override + public double getHullCoolingCapacity() { + return switchReactor; + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/FuelRod.java b/src/main/java/Ic2ExpReactorPlanner/components/FuelRod.java new file mode 100644 index 0000000000..588e221424 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/FuelRod.java @@ -0,0 +1,166 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents some form of fuel rod (may be single, dual, or quad). + * @author Brian McCloud + */ +public class FuelRod extends ReactorItem { + + private final int energyMult; + private final double heatMult; + private final int rodCount; + private final boolean moxStyle; + + private static boolean GT509behavior = false; + private static boolean GTNHbehavior = false; + + public static void setGT509Behavior(boolean value) { + GT509behavior = value; + } + + public static void setGTNHBehavior(boolean value) { + GTNHbehavior = value; + } + + public FuelRod(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod, + final int energyMult, final double heatMult, final int rodCount, final boolean moxStyle) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + this.energyMult = energyMult; + this.heatMult = heatMult; + this.rodCount = rodCount; + this.moxStyle = moxStyle; + } + + public FuelRod(final FuelRod other) { + super(other); + this.energyMult = other.energyMult; + this.heatMult = other.heatMult; + this.rodCount = other.rodCount; + this.moxStyle = other.moxStyle; + } + + @Override + public boolean isNeutronReflector() { + return !isBroken(); + } + + private int countNeutronNeighbors() { + int neutronNeighbors = 0; + ReactorItem component = parent.getComponentAt(row + 1, col); + if (component != null && component.isNeutronReflector()) { + neutronNeighbors++; + } + component = parent.getComponentAt(row - 1, col); + if (component != null && component.isNeutronReflector()) { + neutronNeighbors++; + } + component = parent.getComponentAt(row, col - 1); + if (component != null && component.isNeutronReflector()) { + neutronNeighbors++; + } + component = parent.getComponentAt(row, col + 1); + if (component != null && component.isNeutronReflector()) { + neutronNeighbors++; + } + return neutronNeighbors; + } + + protected void handleHeat(final int heat) { + List heatableNeighbors = new ArrayList<>(4); + ReactorItem component = parent.getComponentAt(row + 1, col); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row - 1, col); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row, col - 1); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + component = parent.getComponentAt(row, col + 1); + if (component != null && component.isHeatAcceptor()) { + heatableNeighbors.add(component); + } + if (heatableNeighbors.isEmpty()) { + parent.adjustCurrentHeat(heat); + currentHullHeating = heat; + } else { + currentComponentHeating = heat; + for (ReactorItem heatableNeighbor : heatableNeighbors) { + heatableNeighbor.adjustCurrentHeat(heat / heatableNeighbors.size()); + } + int remainderHeat = heat % heatableNeighbors.size(); + heatableNeighbors.get(0).adjustCurrentHeat(remainderHeat); + } + } + + @Override + public double generateHeat() { + int pulses = countNeutronNeighbors() + (rodCount == 1 ? 1 : (rodCount == 2) ? 2 : 3); + int heat = (int)(heatMult * pulses * (pulses + 1)); + if (moxStyle && parent.isFluid() && (parent.getCurrentHeat() / parent.getMaxHeat()) > 0.5) { + heat *= 2; + } + currentHeatGenerated = heat; + minHeatGenerated = Math.min(minHeatGenerated, heat); + maxHeatGenerated = Math.max(maxHeatGenerated, heat); + handleHeat(heat); + return currentHeatGenerated; + } + + @Override + public double generateEnergy() { + int pulses = countNeutronNeighbors() + (rodCount == 1 ? 1 : (rodCount == 2) ? 2 : 3); + double energy = energyMult * pulses; + if (GT509behavior || "GT5".equals(sourceMod)) { + energy *= 2;//EUx2 if from GT5.09 or in GT5.09 mode + if (moxStyle) { + energy *= (1 + 1.5 * parent.getCurrentHeat() / parent.getMaxHeat()); + } + } + else if (GTNHbehavior || "GTNH".equals(sourceMod)) { + energy *= 10;//EUx10 if from GTNH or in GTNH mode + if (moxStyle) { + energy *= (1 + 1.5 * parent.getCurrentHeat() / parent.getMaxHeat()); + } + } else if (moxStyle) { + energy *= (1 + 4.0 * parent.getCurrentHeat() / parent.getMaxHeat()); + } + minEUGenerated = Math.min(minEUGenerated, energy); + maxEUGenerated = Math.max(maxEUGenerated, energy); + currentEUGenerated = energy; + parent.addEUOutput(energy); + applyDamage(1.0); + return energy; + } + + @Override + public int getRodCount() { + return rodCount; + } + + @Override + public double getCurrentOutput() { + if (parent != null) { + if (parent.isFluid()) { + return currentHeatGenerated; + } else { + return currentEUGenerated; + } + } + return 0; + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Plating.java b/src/main/java/Ic2ExpReactorPlanner/components/Plating.java new file mode 100644 index 0000000000..d792e06035 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/Plating.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import Ic2ExpReactorPlanner.Reactor; +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents some form of plating, which changes how much heat the reactor can + * hold before causing external effects (up to and including explosion), as well + * as somewhat reducing explosion power. + * @author Brian McCloud + */ +public class Plating extends ReactorItem { + + private final int heatAdjustment; + + public Plating(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod, final int heatAdjustment, final double explosionPowerMultiplier) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + this.heatAdjustment = heatAdjustment; + this.explosionPowerMultiplier = explosionPowerMultiplier; + } + + public Plating(Plating other) { + super(other); + this.heatAdjustment = other.heatAdjustment; + this.explosionPowerMultiplier = other.explosionPowerMultiplier; + } + + @Override + public void addToReactor(final Reactor parent, final int row, final int col) { + super.addToReactor(parent, row, col); + if (parent != null) { + parent.adjustMaxHeat(heatAdjustment); + } + } + + @Override + public void removeFromReactor() { + if (parent != null) { + parent.adjustMaxHeat(-heatAdjustment); + } + super.removeFromReactor(); + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/ReactorItem.java b/src/main/java/Ic2ExpReactorPlanner/components/ReactorItem.java new file mode 100644 index 0000000000..4c4e0bb01b --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/ReactorItem.java @@ -0,0 +1,533 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import java.util.HashMap; +import java.util.ResourceBundle; + +import Ic2ExpReactorPlanner.Reactor; +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents an item (component) in an IndustrialCraft2 Experimental Nuclear + * Reactor. + * + * @author Brian McCloud + */ +public class ReactorItem { + + public static HashMap sComponentMap = new HashMap(); + // Fundamental values, set at object instantiation, should never need to be + // changed. + public final int id; + public final String baseName; // this is the non-localized version, for + // internal program use + public final String name; // this is expected to be localized, for display + // usage. + protected double maxDamage; + + public double getMaxDamage() { + return maxDamage; + } + + protected double maxHeat; + + public double getMaxHeat() { + return maxHeat; + } + + public final String sourceMod; // for potentially adjusting controls based + // on whether the mod is in use, will be + // null to indicate the item is part of base + // IC2. + public final GT_ItemStack mItem; + + // Simulation setting values + private double initialHeat = 0; + + public double getInitialHeat() { + return initialHeat; + } + + public void setInitialHeat(final double value) { + if (this.isHeatAcceptor() && value >= 0 && value < this.maxHeat) { + initialHeat = value; + } + } + private int automationThreshold = 9000; + + public int getAutomationThreshold() { + return automationThreshold; + } + + public void setAutomationThreshold(final int value) { + if (maxHeat > 1 || maxDamage > 1) { + automationThreshold = value; + } + } + private int reactorPause = 0; + + public int getReactorPause() { + return reactorPause; + } + + public void setReactorPause(final int value) { + if (maxHeat > 1 || maxDamage > 1) { + reactorPause = value; + } + } + + // fields below here are not to be copied by the copy constructor. + + // Parent reactor and position + protected Reactor parent = null; + protected int row = -10; + protected int col = -10; + + // Special variable for holding information about this item from last + // simulation. + // Usage of StringBuffer instead of StringBuilder is deliberate - this may + // be accessed by + // both the simulation worker thread and the event dispatch thread. + public final StringBuffer info = new StringBuffer(1000); + + // Calculated values - readable from outside, but only writable by + // subclasses. + protected double currentDamage = 0; + public double getCurrentDamage() { + return currentDamage; + } + protected double currentHeat = 0; + public double getCurrentHeat() { + return currentHeat; + } + protected double maxReachedHeat = 0; + public double getMaxReachedHeat() { + return maxReachedHeat; + } + + protected double currentEUGenerated = 0; + public double getCurrentEUGenerated() { + return currentEUGenerated; + } + protected double minEUGenerated = Double.MAX_VALUE; + public double getMinEUGenerated() { + return minEUGenerated; + } + protected double maxEUGenerated = 0; + public double getMaxEUGenerated() { + return maxEUGenerated; + } + + protected double currentHeatGenerated = 0; + public double getCurrentHeatGenerated() { + return currentHeatGenerated; + } + protected double minHeatGenerated = Double.MAX_VALUE; + public double getMinHeatGenerated() { + return minHeatGenerated; + } + protected double maxHeatGenerated = 0; + public double getMaxHeatGenerated() { + return maxHeatGenerated; + } + + protected double currentHullHeating = 0; + public double getCurrentHullHeating() { + return currentHullHeating; + } + protected double currentComponentHeating = 0; + public double getCurrentComponentHeating() { + return currentComponentHeating; + } + protected double currentHullCooling = 0; + public double getCurrentHullCooling() { + return currentHullCooling; + } + protected double currentVentCooling = 0; + public double getCurrentVentCooling() { + return currentVentCooling; + } + protected double bestVentCooling = 0; + public double getBestVentCooling() { + return bestVentCooling; + } + + protected double currentCellCooling = 0; + public double getCurrentCellCooling() { + return currentCellCooling; + } + protected double bestCellCooling = 0; + public double getBestCellCooling() { + return bestCellCooling; + } + + protected double currentCondensatorCooling = 0; + public double getCurrentCondensatorCooling() { + return currentCondensatorCooling; + } + protected double bestCondensatorCooling = 0; + public double getBestCondensatorCooling() { + return bestCondensatorCooling; + } + + protected double explosionPowerMultiplier = 1; + + protected static final ResourceBundle BUNDLE = ResourceBundle.getBundle("Ic2ExpReactorPlanner/Bundle"); + + protected ReactorItem(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, String sourceMod) { + this.id = id; + this.baseName = baseName; + this.name = aItem.mItem.getItemStackDisplayName(aItem.toStack()); + this.mItem = aItem; + this.maxDamage = maxDamage; + this.maxHeat = maxHeat; + if (maxHeat > 1) { + automationThreshold = (int) (maxHeat * 0.9); + } + else if (maxDamage > 1) { + automationThreshold = (int) (maxDamage * 1.1); + } + if (sourceMod == null) { + sourceMod = "IC2"; + } + this.sourceMod = sourceMod; + sComponentMap.put(sourceMod+"."+aItem.mItem.getUnlocalizedName()+"."+aItem.mMetaData, this); + } + + // Protected copy constructor for use by subclasses. Generalized copying + // should be done with a method in ComponentFactory (which can check which + // subclass copy constructor to use). + protected ReactorItem(final ReactorItem other) { + this.id = other.id; + this.baseName = other.baseName; + this.name = other.name; + this.mItem = other.mItem; + this.maxDamage = other.maxDamage; + this.maxHeat = other.maxHeat; + this.initialHeat = other.initialHeat; + this.automationThreshold = other.automationThreshold; + this.reactorPause = other.reactorPause; + this.sourceMod = other.sourceMod; + } + + /** + * Gets the name of the component, and the initial heat (if applicable). + * + * @return the name of this component, and potentially initial heat. + */ + @Override + public String toString() { + String result = name; + if (initialHeat > 0) { + result += String.format(BUNDLE.getString("UI.InitialHeatDisplay"), (int) initialHeat); + } + return result; + } + + /** + * Checks if this component can accept heat. (e.g. from adjacent fuel rods, + * or from an exchanger) + * + * @return true if this component can accept heat, false otherwise. + */ + public boolean isHeatAcceptor() { + // maxHeat of 1 means this component never accepts heat (though it might + // take damage instead) + return maxHeat > 1 && !isBroken(); + } + + /** + * Determines if this component can be cooled down, such as by a component + * heat vent. + * + * @return true if this component can be cooled down, false otherwise. + */ + public boolean isCoolable() { + return maxHeat > 1 && !(this instanceof Condensator); + } + + /** + * Checks if this component acts as a neutron reflector, and boosts + * performance of adjacent fuel rods, either by being a "neutron reflector" + * item or by being a fuel rod. + * + * @return true if this component reflects neutrons, false otherwise. + */ + public boolean isNeutronReflector() { + return false; + } + + /** + * Prepare for a new reactor tick. + */ + public void preReactorTick() { + currentHullHeating = 0.0; + currentComponentHeating = 0.0; + currentHullCooling = 0.0; + currentVentCooling = 0.0; + currentCellCooling = 0.0; + currentCondensatorCooling = 0.0; + currentEUGenerated = 0; + currentHeatGenerated = 0; + } + + /** + * Generate heat if appropriate for component type, and spread to reactor or + * adjacent cells. + * + * @return the amount of heat generated by this component. + */ + public double generateHeat() { + return 0.0; + } + + /** + * Generate energy if appropriate for component type. + * + * @return the number of EU generated by this component during the current + * reactor tick. + */ + public double generateEnergy() { + return 0.0; + } + + /** + * Dissipate (aka vent) heat if appropriate for component type. + * + * @return the amount of heat successfully vented during the current reactor + * tick. + */ + public double dissipate() { + return 0.0; + } + + /** + * Transfer heat between component, neighbors, and/or reactor, if + * appropriate for component type. + */ + public void transfer() { + // do nothing by default. + } + + /** + * Adds this component to a new reactor, and applies changes to the reactor + * when adding this component if appropriate, such as for reactor plating. + * + * @param parent + * the reactor to add this component to. + * @param row + * the row this component will be in. + * @param col + * the column this component will be in. + */ + public void addToReactor(final Reactor parent, final int row, final int col) { + // call removeFromReactor first, in case it had previously been added to + // a different reactor (unlikely) + removeFromReactor(); + this.parent = parent; + this.row = row; + this.col = col; + } + + /** + * Removes this component from its reactor (if any), and applies changes to + * the reactor when removing this component if appropriate, such as for + * reactor plating. + */ + public void removeFromReactor() { + parent = null; + this.row = -10; + this.col = -10; + } + + /** + * Resets heat to 0 (used when resetting simulation). + */ + public final void clearCurrentHeat() { + currentHeat = initialHeat; + bestVentCooling = 0.0; + bestCondensatorCooling = 0.0; + bestCellCooling = 0.0; + minEUGenerated = Double.MAX_VALUE; + maxEUGenerated = 0.0; + minHeatGenerated = Double.MAX_VALUE; + maxHeatGenerated = 0.0; + maxReachedHeat = initialHeat; + } + + /** + * Adjusts the component heat up or down + * + * @param heat + * the amount of heat to adjust by (positive to add heat, + * negative to remove heat). + * @return the amount of heat adjustment refused. (e.g. due to going below + * minimum heat, breaking due to excessive heat, or attempting to + * remove heat from a condensator) + */ + public double adjustCurrentHeat(final double heat) { + if (isHeatAcceptor()) { + double result = 0.0; + double tempHeat = getCurrentHeat(); + tempHeat += heat; + if (tempHeat > getMaxHeat()) { + result = getMaxHeat() - tempHeat + 1; + tempHeat = getMaxHeat(); + } + else if (tempHeat < 0.0) { + result = tempHeat; + tempHeat = 0.0; + } + currentHeat = tempHeat; + maxReachedHeat = Math.max(maxReachedHeat, currentHeat); + return result; + } + return heat; + } + + /** + * Clears the damage back to 0 (used when resetting simulation, or replacing + * the component in an automation simulation). + */ + public final void clearDamage() { + currentDamage = 0.0; + } + + /** + * Applies damage to the component, as opposed to heat. Mainly used for fuel + * rods and neutron reflectors that lose durability as the reactor runs, but + * can't recover it via cooling. + * + * @param damage + * the damage to apply (only used if positive). + */ + public final void applyDamage(final double damage) { + // maxDamage of 1 is treated as meaning the component doesn't accept + // damage (though it might accept heat instead) + // if someone actually writes a mod with such a flimsy component, I + // might have to rethink this. + if (maxDamage > 1 && damage > 0.0) { + currentDamage += damage; + } + } + + /** + * Determines if this component is broken in the current tick of the + * simulation + * + * @return true if the component has broken either from damage (e.g. neutron + * reflectors, fuel rods) or from heat (e.g. heat vents, coolant + * cells), false otherwise. + */ + public boolean isBroken() { + return currentHeat >= getMaxHeat() || currentDamage >= getMaxDamage(); + } + + /** + * The number of fuel rods in this component (0 for non-fuel-rod + * components). + * + * @return The number of fuel rods in this component, or 0 if this component + * has no fuel rods. + */ + public int getRodCount() { + return 0; + } + + /** + * Gets a value added in the formula for calculating explosion power. + * + * @return the additive value for explosion power caused by this component, + * or 0 if this component doesn't affect the addition part of the + * explosion calculation. + */ + public double getExplosionPowerOffset() { + if (!isBroken()) { + if (getRodCount() == 0 && isNeutronReflector()) { + return -1; + } + return 2 * getRodCount(); // all known fuel rods (including those + // from GT) use this formula, and + // non-rod components return 0 for + // getRodCount + } + return 0; + } + + /** + * Gets a value multiplied in the formula for calculating explosion power. + * + * @return the multiplier value for explosion power caused by this + * component, or 1 if this component doesn't affect the + * multiplication part of the explosion calculation. + */ + public double getExplosionPowerMultiplier() { + return explosionPowerMultiplier; + } + + /** + * Finds the theoretical maximum venting of this component, regardless of + * whether this venting is from itself, directly from the reactor, or from + * adjacent components. + * + * @return the capacity of this component to vent heat. + */ + public double getVentCoolingCapacity() { + return 0; + } + + /** + * Finds the theoretical maximum hull cooling of this component. + * + * @return the capacity of this component to remove heat from the reactor + * hull. + */ + public double getHullCoolingCapacity() { + return 0; + } + + /** + * Gets the current "output" of this component, presumably for writing to + * CSV data. What this "output" means may vary by component type or reactor + * type. + * + * @return the output of this component for the current reactor tick. + */ + public double getCurrentOutput() { + return 0; + } + + /** + * Determines whether this component expects to produces some sort of output + * each reactor tick, e.g. for purposes of tracking in a CSV file. + * + * @return true if this component produces output (such as EU or vented + * heat), false otherwise. + */ + public boolean producesOutput() { + return getVentCoolingCapacity() > 0 || getRodCount() > 0; + } + + /** + * Determines if this component needs input from a Reactor Coolant Injector. + * Simply returns false for non-condensator items. + * + * @return true if this is a condensator that has absorbed enough heat to + * require the appropriate item added to repair it, false otherwise. + */ + public boolean needsCoolantInjected() { + return false; + } + + /** + * Simulates having a coolant item added by a Reactor Coolant Injector. + */ + public void injectCoolant() { + // do nothing by default. + } + +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Reflector.java b/src/main/java/Ic2ExpReactorPlanner/components/Reflector.java new file mode 100644 index 0000000000..465641972a --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/Reflector.java @@ -0,0 +1,66 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import Ic2ExpReactorPlanner.MaterialsList; +import gregtech.api.objects.GT_ItemStack; + +import java.awt.Image; + +/** + * Represents a neutron reflector in a reactor. + * @author Brian McCloud + */ +public class Reflector extends ReactorItem { + + private static String mcVersion = "1.12.2"; + + public Reflector(final int id, final String baseName, final GT_ItemStack aStack, final double maxDamage, final double maxHeat, final String sourceMod) { + super(id, baseName, aStack, maxDamage, maxHeat, sourceMod); + } + + public Reflector(final Reflector other) { + super(other); + } + + @Override + public boolean isNeutronReflector() { + return !isBroken(); + } + + @Override + public double generateHeat() { + ReactorItem component = parent.getComponentAt(row - 1, col); + if (component != null) { + applyDamage(component.getRodCount()); + } + component = parent.getComponentAt(row, col + 1); + if (component != null) { + applyDamage(component.getRodCount()); + } + component = parent.getComponentAt(row + 1, col); + if (component != null) { + applyDamage(component.getRodCount()); + } + component = parent.getComponentAt(row, col - 1); + if (component != null) { + applyDamage(component.getRodCount()); + } + return 0; + } + + @Override + public double getMaxDamage() { + if (maxDamage > 1 && "1.7.10".equals(mcVersion)) { + return maxDamage / 3; + } + return maxDamage; + } + + public static void setMcVersion(String newVersion) { + mcVersion = newVersion; + } +} diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Vent.java b/src/main/java/Ic2ExpReactorPlanner/components/Vent.java new file mode 100644 index 0000000000..a43383f694 --- /dev/null +++ b/src/main/java/Ic2ExpReactorPlanner/components/Vent.java @@ -0,0 +1,110 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Ic2ExpReactorPlanner.components; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.objects.GT_ItemStack; + +/** + * Represents some kind of vent in a reactor. + * @author Brian McCloud + */ +public class Vent extends ReactorItem { + + private final int selfVent; + private final int hullDraw; + private final int sideVent; + + public Vent(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod, + final int selfVent, final int hullDraw, final int sideVent) { + super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); + this.selfVent = selfVent; + this.hullDraw = hullDraw; + this.sideVent = sideVent; + } + + public Vent(final Vent other) { + super(other); + this.selfVent = other.selfVent; + this.hullDraw = other.hullDraw; + this.sideVent = other.sideVent; + } + + @Override + public double dissipate() { + double deltaHeat = Math.min(hullDraw, parent.getCurrentHeat()); + currentHullCooling = deltaHeat; + parent.adjustCurrentHeat(-deltaHeat); + this.adjustCurrentHeat(deltaHeat); + final double currentDissipation = Math.min(selfVent, getCurrentHeat()); + currentVentCooling = currentDissipation; + parent.ventHeat(currentDissipation); + adjustCurrentHeat(-currentDissipation); + if (sideVent > 0) { + List coolableNeighbors = new ArrayList<>(4); + ReactorItem component = parent.getComponentAt(row - 1, col); + if (component != null && component.isCoolable()) { + coolableNeighbors.add(component); + } + component = parent.getComponentAt(row, col + 1); + if (component != null && component.isCoolable()) { + coolableNeighbors.add(component); + } + component = parent.getComponentAt(row + 1, col); + if (component != null && component.isCoolable()) { + coolableNeighbors.add(component); + } + component = parent.getComponentAt(row, col - 1); + if (component != null && component.isCoolable()) { + coolableNeighbors.add(component); + } + for (ReactorItem coolableNeighbor : coolableNeighbors) { + double rejectedCooling = coolableNeighbor.adjustCurrentHeat(-sideVent); + double tempDissipatedHeat = sideVent + rejectedCooling; + parent.ventHeat(tempDissipatedHeat); + currentVentCooling += tempDissipatedHeat; + } + } + bestVentCooling = Math.max(bestVentCooling, currentVentCooling); + return currentDissipation; + } + + @Override + public double getVentCoolingCapacity() { + double result = selfVent; + if (sideVent > 0) { + ReactorItem component = parent.getComponentAt(row - 1, col); + if (component != null && component.isCoolable()) { + result += sideVent; + } + component = parent.getComponentAt(row, col + 1); + if (component != null && component.isCoolable()) { + result += sideVent; + } + component = parent.getComponentAt(row + 1, col); + if (component != null && component.isCoolable()) { + result += sideVent; + } + component = parent.getComponentAt(row, col - 1); + if (component != null && component.isCoolable()) { + result += sideVent; + } + } + return result; + } + + @Override + public double getHullCoolingCapacity() { + return hullDraw; + } + + @Override + public double getCurrentOutput() { + return currentVentCooling; + } + } diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 15b0d8629c..8d20f2ff67 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -62,10 +62,11 @@ public class LoadedMods { public static boolean CropsPlusPlus = false; //Barts Crop Mod public static boolean Reliquary = false; public static boolean SpiceOfLife = false; - - + public static boolean BartWorks = false; + public static boolean GoodGenerator = false; private static int totalMods; + @SuppressWarnings("deprecation") public static void checkLoaded(){ Logger.INFO("Looking for optional mod prereqs."); @@ -124,6 +125,16 @@ public class LoadedMods { Logger.INFO("Components enabled for: Advanced Solar Panels"); totalMods++; } + if (isModLoaded("GoodGenerator")) { + GoodGenerator = true; + Logger.INFO("Components enabled for: GoodGenerator"); + totalMods++; + } + if (isModLoaded("bartworks")) { + BartWorks = true; + Logger.INFO("Components enabled for: BartWorks"); + totalMods++; + } if (isModLoaded("BuildCraft")){ BuildCraft = true; Logger.INFO("Components enabled for: BuildCraft"); diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index aaec2024e4..f3890aa932 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -22,7 +22,6 @@ import com.google.common.reflect.ClassPath; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; public class ReflectionUtils { @@ -271,6 +270,21 @@ public class ReflectionUtils { } } + public static Field[] getAllFields(final Class aClass) { + if (aClass == null) { + return null; + } + Field[] aFields = aClass.getDeclaredFields(); + for (Field f : aFields) { + CachedField y = mCachedFields.get(aClass.getName()+"."+f.getName()); + if (y == null) { + makeFieldAccessible(f); + cacheField(aClass, f); + } + } + return aFields; + } + /** * Returns a cached {@link Field} object. * @param aInstance - {@link Object} to get the field instance from. @@ -435,7 +449,7 @@ public class ReflectionUtils { t.printStackTrace(); } } - + /** * Allows to change the state of an immutable instance. Huh?!? */ @@ -523,7 +537,7 @@ public class ReflectionUtils { Logger.REFLECTION("Invoke failed or did something wrong."); return false; } - + public static boolean invokeVoid(Object objectInstance, Method method, Object[] values){ if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); @@ -537,8 +551,8 @@ public class ReflectionUtils { if (mInvokingMethod != null){ Logger.REFLECTION(methodName+" was not null."); mInvokingMethod.invoke(objectInstance, values); - Logger.REFLECTION("Successfully invoked "+methodName+"."); - return true; + Logger.REFLECTION("Successfully invoked "+methodName+"."); + return true; } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { @@ -583,7 +597,7 @@ public class ReflectionUtils { String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); try { - return method.invoke(objectInstance, values); + return method.invoke(objectInstance, values); } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); diff --git a/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java b/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java new file mode 100644 index 0000000000..d3386a1608 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/bartworks/BW_Utils.java @@ -0,0 +1,55 @@ +package gtPlusPlus.xmod.bartworks; + +import java.lang.reflect.Method; +import java.util.ArrayList; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; + +public class BW_Utils { + + private final static Method sName; + private final static Method sGet; + private static final Class sClassBW_NonMeta_MaterialItems; + + static { + sName = ReflectionUtils.getMethod(Enum.class, "name"); + sClassBW_NonMeta_MaterialItems = ReflectionUtils.getClass("com.github.bartimaeusnek.bartworks.system.material.BW_NonMeta_MaterialItems"); + sGet = ReflectionUtils.getMethod(sClassBW_NonMeta_MaterialItems, "get", long.class, Object[].class); + } + + public enum NonMeta_MaterialItem { + Depleted_Tiberium_1, + Depleted_Tiberium_2, + Depleted_Tiberium_4, + TiberiumCell_1, + TiberiumCell_2, + TiberiumCell_4, + TheCoreCell, + Depleted_TheCoreCell; + } + + public static ItemStack getBW_NonMeta_MaterialItems(NonMeta_MaterialItem aItem, long aAmount) { + if (sClassBW_NonMeta_MaterialItems != null && sClassBW_NonMeta_MaterialItems.isEnum()) { + for (Object obj : sClassBW_NonMeta_MaterialItems.getEnumConstants()) { + try { + if (aItem.name().equals(ReflectionUtils.invokeNonBool(obj, sName, new Object[] {}))) { + return ((ItemStack) ReflectionUtils.invokeNonBool(obj, sGet, new Object[] {aAmount, new Object[] {}})).copy(); + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + } + return null; + } + + public static ArrayList getAll(int aStackSize){ + ArrayList aItems = new ArrayList(); + aItems.add(getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_1, aStackSize)); + aItems.add(getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_2, aStackSize)); + aItems.add(getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TiberiumCell_4, aStackSize)); + aItems.add(getBW_NonMeta_MaterialItems(NonMeta_MaterialItem.TheCoreCell, aStackSize)); + return aItems; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/goodgenerator/GG_Utils.java b/src/main/java/gtPlusPlus/xmod/goodgenerator/GG_Utils.java new file mode 100644 index 0000000000..d501958fcd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/goodgenerator/GG_Utils.java @@ -0,0 +1,55 @@ +package gtPlusPlus.xmod.goodgenerator; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.bartworks.BW_Utils.NonMeta_MaterialItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class GG_Utils { + + private static final Class sClassFuelRodLoader; + private static final Field[] sClassFuelRodLoaderFields; + + static { + sClassFuelRodLoader = ReflectionUtils.getClass("goodgenerator.loader.FuelRodLoader"); + sClassFuelRodLoaderFields = ReflectionUtils.getAllFields(sClassFuelRodLoader); + } + + public enum GG_Fuel_Rod { + rodCompressedUranium, + rodCompressedUranium_2, + rodCompressedUranium_4, + rodCompressedPlutonium, + rodCompressedPlutonium_2, + rodCompressedPlutonium_4, + rodCompressedUraniumDepleted, + rodCompressedUraniumDepleted_2, + rodCompressedUraniumDepleted_4, + rodCompressedPlutoniumDepleted, + rodCompressedPlutoniumDepleted_2, + rodCompressedPlutoniumDepleted_4,; + } + + public static ItemStack getGG_Fuel_Rod(GG_Fuel_Rod aItem, int aAmount) { + if (sClassFuelRodLoader != null) { + return ItemUtils.getSimpleStack((Item) ReflectionUtils.getFieldValue(ReflectionUtils.getField(sClassFuelRodLoader, aItem.name())), aAmount); + } + return null; + } + + public static ArrayList getAll(int aStackSize){ + ArrayList aItems = new ArrayList(); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium, aStackSize)); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium_2, aStackSize)); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedUranium_4, aStackSize)); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium, aStackSize)); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium_2, aStackSize)); + aItems.add(getGG_Fuel_Rod(GG_Fuel_Rod.rodCompressedPlutonium_4, aStackSize)); + return aItems; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 999d80199f..3e294a076c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -54,6 +54,7 @@ import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; +import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputerCube_Setup; import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator; @@ -178,6 +179,7 @@ public class HANDLER_GT { generateElementalDuplicatorRecipes(); Meta_GT_Proxy.fixIC2FluidNames(); GT_ComputercubeDescription.addStandardDescriptions(); + GT_ComputerCube_Setup.init(); RecipeLoader_AlgaeFarm.generateRecipes(); if (LoadedMods.AdvancedSolarPanel) { RecipeLoader_MolecularTransformer.run(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java index 0ebfd65aeb..477bcef092 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -8,6 +8,7 @@ import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.gui.GT_Slot_Output; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; @@ -151,11 +152,11 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { return null; } Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - ItemStack tStack = tSlot.getStack(); if (tSlot == null) { Logger.INFO("Null Slot?"); } else { + ItemStack tStack = tSlot.getStack(); Logger.INFO("Good Slot!"); if (aSlotIndex == 0) { Logger.INFO("Slot is 0"); @@ -224,21 +225,29 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { else { if (aShifthold == 1) { tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); return null; } + + if (aMouseclick == 1) { + tSlot.putStack(null); + } if (aMouseclick == 0) { if (tStack == null) { if (getSlot(58).getStack() != null && aSlotIndex != 58) { tSlot.putStack(getSlot(58).getStack().copy()); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, new GT_ItemStack(getSlot(58).getStack().copy())); } else { tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); } return null; } for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); }*/ @@ -246,6 +255,7 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { } } tSlot.putStack(null); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getSimulator().slotClick(aSlotIndex, null); return null; } if (tStack == null) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java index d226503b9c..47795f4510 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -46,7 +46,7 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", 7, 136, 16448255); this.fontRendererObj.drawString("Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); - this.fontRendererObj.drawString("Runtime: " + ((tContainer.mEUOut > 0) ? ((tContainer.mEU / tContainer.mEUOut) / 20.0F) : 0.0F) + "secs", 7, 152, 16448255); + this.fontRendererObj.drawString("Runtime: " + ((tContainer.mProgress > 0) ? (/*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) : 0) + "secs", 7, 152, 16448255); break; case 2 : this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java new file mode 100644 index 0000000000..bd2df1b8ff --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java @@ -0,0 +1,74 @@ +package gtPlusPlus.xmod.gregtech.common.computer; + +import static gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube.sReactorList; + +import java.util.ArrayList; + +import Ic2ExpReactorPlanner.ComponentFactory; +import gregtech.api.enums.ItemList; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.bartworks.BW_Utils; +import gtPlusPlus.xmod.goodgenerator.GG_Utils; +import net.minecraft.item.ItemStack; + +public class GT_ComputerCube_Setup { + + public static void init() { + Logger.INFO("[Reactor Simulator] Added " + ComponentFactory.getComponentCount() + " components to ComponentFactory."); + if (sReactorList == null) { + sReactorList = new ArrayList(); + + String[] aIc2Items = new String[]{ + "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple", + "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent", + "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread", + "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/ + }; + + for (String aItem : aIc2Items) { + ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1); + if (!ItemUtils.checkForInvalidItems(aStack)) { + Logger.INFO("Unable to find IC2 Item: " + aItem); + CORE.crash("Unable to find IC2 Item: " + aItem); + } + else { + sReactorList.add(new GT_ItemStack(aStack.copy())); + } + } + + ItemList[] aGtItems = new ItemList[]{ + ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, /*ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4,*/ + ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.MNqCell_1, + ItemList.MNqCell_2, ItemList.MNqCell_4, ItemList.Reactor_Coolant_He_1, ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1, + ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6, ItemList.Reactor_Coolant_Sp_1, ItemList.Reactor_Coolant_Sp_2, ItemList.Reactor_Coolant_Sp_3, + ItemList.Reactor_Coolant_Sp_6 + }; + + for (ItemList aItem : aGtItems) { + sReactorList.add(new GT_ItemStack(aItem.get(1))); + } + + if (LoadedMods.BartWorks) { + ArrayList aBartReactorItems = BW_Utils.getAll(1); + for (ItemStack aReactorItem : aBartReactorItems) { + sReactorList.add(new GT_ItemStack(aReactorItem)); + } + } + + if (LoadedMods.GoodGenerator) { + ArrayList aGlodReactorItems = GG_Utils.getAll(1); + for (ItemStack aReactorItem : aGlodReactorItems) { + sReactorList.add(new GT_ItemStack(aReactorItem)); + } + } + Logger.INFO("[Reactor Simulator] Added " + sReactorList.size() + " components to GT_TileEntity_ComputerCube."); + + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java new file mode 100644 index 0000000000..e0bedb5d18 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java @@ -0,0 +1,149 @@ +package gtPlusPlus.xmod.gregtech.common.computer; + +import java.util.ArrayList; +import java.util.HashMap; + +import Ic2ExpReactorPlanner.AutomationSimulator; +import Ic2ExpReactorPlanner.Reactor; +import Ic2ExpReactorPlanner.SimulationData; +import Ic2ExpReactorPlanner.components.ReactorItem; +import gregtech.api.objects.GT_ItemStack; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; + +public class GT_Computercube_Simulator { + + private static final HashMap> sSlotPositions = new HashMap>(); + + static { + int aSlot = 4; + for (int column = 0; column < 6; column++) { + for (int row = 0; row < 9; row++) { + sSlotPositions.put(aSlot++, new Pair(row, column)); + } + } + } + + private final Reactor reactor = new Reactor(); + + public AutomationSimulator simulator = null; + /** + * The reactor that was last simulated. + */ + public Reactor simulatedReactor = null; + + private String currentReactorCode = null; + + private String currentReactorOldCode = null; + + private ArrayList output = new ArrayList(); + + private final GT_TileEntity_ComputerCube mTile; + + public GT_Computercube_Simulator(GT_TileEntity_ComputerCube aTile) { + mTile = aTile; + } + + public void slotClick(int aSlot, GT_ItemStack aStack) { + + /*if (selection != null) { + componentToPlace = ComponentFactory.createComponent(selection.getActionCommand()); + if (componentToPlace != null) { + componentToPlace.setInitialHeat(((Number)componentHeatSpinner.getValue()).intValue()); + componentToPlace.setAutomationThreshold(((Number)placingThresholdSpinner.getValue()).intValue()); + componentToPlace.setReactorPause(((Number)placingReactorPauseSpinner.getValue()).intValue()); + } + }*/ + if (aSlot >= 4 && aSlot < 58) { + Pair aSpot = sSlotPositions.get(aSlot); + ReactorItem aItem; + if (aStack == null) { + aItem = null; + } + else { + + Logger.INFO("Using lookup key: "+ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData); + aItem = ReactorItem.sComponentMap.get(ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData); + + } + int aRow = aSpot.getKey(); + int aColumn = aSpot.getValue(); + Logger.INFO("Putting "+(aItem == null ? "null" : aItem.name)+" at x:"+aRow+", y:"+aColumn); + reactor.setComponentAt(aColumn, aRow, aItem); + currentReactorCode = reactor.getCode(); + currentReactorOldCode = reactor.getOldCode(); + Logger.INFO("Code: "+currentReactorCode); + } + //maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat())); + //heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1); + //heatSpinnerModel.setValue(Math.min(((Number)heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1)); + //temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int) (reactor.getMaxHeat() * 0.4), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0))); + } + + public void simulate() { + /*if (Utils.isClient()) { + return; + }*/ + if (simulator != null && simulator.isRunning()) { + Logger.INFO("Simulator Running, Stopping."); + simulator.cancel(); + } + Logger.INFO("Starting Simulator."); + mTile.mHeat = 0; + mTile.mEU = 0; + currentReactorCode = reactor.getCode(); + currentReactorOldCode = reactor.getOldCode(); + output.clear(); + simulatedReactor = new Reactor(); + simulatedReactor.setCode(reactor.getCode()); + Logger.INFO("Making new AutomationSimulator."); + simulator = new AutomationSimulator(simulatedReactor, output, mTile); + Logger.INFO("Starting AutomationSimulator.process()."); + simulator.process(); + Logger.INFO("Done."); + + SimulationData aData = simulator.getData(); + if (aData != null && aData.totalReactorTicks > 0) { + mTile.mEU = aData.avgEUoutput * aData.totalReactorTicks; + mTile.mEUOut = aData.avgEUoutput; + mTile.mHeat = aData.avgHUoutput; + mTile.mMaxHeat = aData.maxHUoutput; + mTile.mExplosionStrength = aData.explosionPower; + mTile.mHEM = (float) aData.hullHeating; + mTile.mProgress = aData.totalReactorTicks; + } + + for (String s : output) { + Logger.INFO(" "+s); + } + } + + public ArrayList getOutputData() { + return output; + } + + private void clearGrid() { + reactor.clearGrid(); + /*for (int i = 0; i < reactorButtons.length; i++) { + for (int j = 0; j < reactorButtons[i].length; j++) { + reactorButtons[i][j].setIcon(null); + reactorButtons[i][j].setToolTipText(null); + reactorButtonPanels[i][j].setBackground(Color.LIGHT_GRAY); + } + }*/ + output.clear(); + /*materialsArea.setText(reactor.getMaterials().toString()); + componentListArea.setText(reactor.getComponentList().toString()); + maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat())); + heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1); + heatSpinnerModel.setValue(Math.min(((Number) heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1)); + temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0))); + lockCode = true; + codeField.setText(null); + lockCode = false;*/ + } + + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java index dd8c79a855..11d5068374 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.misc; import java.util.ArrayList; import java.util.Collections; +import Ic2ExpReactorPlanner.SimulationData; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; @@ -17,12 +18,16 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.bartworks.BW_Utils; +import gtPlusPlus.xmod.goodgenerator.GG_Utils; import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_ComputerCube; import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_ComputerCube; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; +import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Simulator; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import ic2.core.Ic2Items; @@ -72,6 +77,8 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl public float mHEM = 1.0F, mExplosionStrength = 0.0F; private boolean mNeedsUpdate; + + private GT_Computercube_Simulator mSimulator; public GT_TileEntity_ComputerCube(final int aID, final String aDescription) { super(aID, "computer.cube", "Computer Cube", 5, 114, aDescription); @@ -128,6 +135,14 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl return true; } + public final GT_Computercube_Simulator getSimulator() { + return this.mSimulator; + } + + public final void setSimulator(GT_Computercube_Simulator mSimulator) { + this.mSimulator = mSimulator; + } + @Override public boolean isSimpleMachine() { return true; @@ -160,7 +175,7 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl @Override public boolean ownerControl() { - return true; + return false; } @Override @@ -576,10 +591,12 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl this.mStarted = true; this.mHeat = 0; this.mEU = 0; + mSimulator.simulate(); } public void stopNuclearReactor() { this.mStarted = false; + mSimulator.simulate(); } public void storeAdditionalData(NBTTagCompound aNBT) { @@ -612,44 +629,14 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { super.onFirstTick(aBaseMetaTileEntity); - if (sReactorList == null) { - sReactorList = new ArrayList(); - - String[] aIc2Items = new String[]{ - "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple", - "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent", - "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread", - "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/ - }; - - for (String aItem : aIc2Items) { - ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1); - if (!ItemUtils.checkForInvalidItems(aStack)) { - Logger.INFO("Unable to find IC2 Item: " + aItem); - CORE.crash("Unable to find IC2 Item: " + aItem); - } - else { - sReactorList.add(new GT_ItemStack(aStack.copy())); - } - } - - ItemList[] aGtItems = new ItemList[]{ - ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4, - ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.Reactor_Coolant_He_1, - ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1, ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6, - }; - - for (ItemList aItem : aGtItems) { - sReactorList.add(new GT_ItemStack(aItem.get(1))); - } - - } - } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); + if (mSimulator == null) { + mSimulator = new GT_Computercube_Simulator(this); + } if(this.getBaseMetaTileEntity().isClientSide()) { this.getWorld().markBlockForUpdate(this.getXCoord(), this.getYCoord(), this.getZCoord()); this.mNeedsUpdate = false; @@ -694,7 +681,22 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl } } } - if (this.mMode == 1 && mReactorplanner && this.mStarted && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(32, false)) + + if (this.mMode == 1 && mReactorplanner && this.mSimulator != null && this.mSimulator.simulator != null && this.mSimulator.simulatedReactor != null) { + SimulationData aData = this.mSimulator.simulator.getData(); + if (aData != null && aData.totalReactorTicks > 0 && this.mProgress != aData.totalReactorTicks) { + Logger.INFO("Updating Variables"); + this.mEU = aData.avgEUoutput; + this.mEUOut = (aData.totalEUoutput / aData.totalReactorTicks); + this.mHeat = aData.avgHUoutput; + this.mMaxHeat = aData.maxHUoutput; + this.mExplosionStrength = aData.explosionPower; + this.mHEM = (float) aData.hullHeating; + this.mProgress = aData.totalReactorTicks; + } + } + + /*if (this.mMode == 1 && mReactorplanner && this.mStarted && this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(32, false)) for (int i = 0; i < 25 && this.mStarted; i++) { this.mEUOut = 0; this.mMaxHeat = 10000; @@ -737,7 +739,7 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank impl this.mEULast3 = this.mEULast4; this.mEULast4 = this.mEUOut; this.mEUOut = (this.mEUOut + this.mEULast1 + this.mEULast2 + this.mEULast3 + tEU) / 5; - } + }*/ if (aTick % 20L == 0L) { //this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 10, this.mMode); //this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat); -- cgit