From 3b04061d2638b30492f3e6255fe6c4817e54914c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8F=E3=81=81=E3=83=BC=E3=82=8A=E3=81=83?= Date: Tue, 6 Jun 2023 03:39:03 +0900 Subject: [PATCH] add infinite heating mega blast furnace --- .../metatileentities/GTEMetaTileEntities.java | 3 + ...etaTileEntityAdvancedMegaBlastFurnace.java | 149 ++++++++++++++++++ .../resources/assets/gtexpert/lang/en_us.lang | 4 + .../resources/assets/gtexpert/lang/ja_jp.lang | 4 + 4 files changed, 160 insertions(+) create mode 100644 src/main/java/gtexpert/common/metatileentities/multi/MetaTileEntityAdvancedMegaBlastFurnace.java diff --git a/src/main/java/gtexpert/common/metatileentities/GTEMetaTileEntities.java b/src/main/java/gtexpert/common/metatileentities/GTEMetaTileEntities.java index 4ddc98f0..b3ab0522 100644 --- a/src/main/java/gtexpert/common/metatileentities/GTEMetaTileEntities.java +++ b/src/main/java/gtexpert/common/metatileentities/GTEMetaTileEntities.java @@ -24,6 +24,8 @@ public class GTEMetaTileEntities { public static MetaTileEntityVoidOreMiner VOIDOREMINER; public static MetaTileEntityDraconiumFusion DRACONIUM_FUSION; public static MetaTileEntityDraconiumFusion AWAKENED_DRACONIUM_FUSION; + + public static MetaTileEntityAdvancedMegaBlastFurnace ADVANCED_MEGA_BLAST_FURNACE; public static void init() { /* @@ -65,6 +67,7 @@ public static void init() { SAWMILL = registerMetaTileEntity(12001, new MetaTileEntitySawmill(gteId("sawmill"))); // = registerMetaTileEntity(12002, new MetaTileEntityVoidOreMiner(gteId("####"))); VOIDOREMINER = registerMetaTileEntity(12003, new MetaTileEntityVoidOreMiner(gteId("void_ore_miner"))); + ADVANCED_MEGA_BLAST_FURNACE = registerMetaTileEntity(12006, new MetaTileEntityAdvancedMegaBlastFurnace(gteId("advanced_mega_blast_furnace"))); if (Loader.isModLoaded(GTEValues.MODID_DE) && Loader.isModLoaded(GTEValues.MODID_DA)) { DRACONIUM_FUSION = registerMetaTileEntity(12004, new MetaTileEntityDraconiumFusion.TierDraconic(gteId("draconium_fusion"))); diff --git a/src/main/java/gtexpert/common/metatileentities/multi/MetaTileEntityAdvancedMegaBlastFurnace.java b/src/main/java/gtexpert/common/metatileentities/multi/MetaTileEntityAdvancedMegaBlastFurnace.java new file mode 100644 index 00000000..6af572be --- /dev/null +++ b/src/main/java/gtexpert/common/metatileentities/multi/MetaTileEntityAdvancedMegaBlastFurnace.java @@ -0,0 +1,149 @@ +package gtexpert.common.metatileentities.multi; + +import gregicality.multiblocks.api.capability.impl.GCYMMultiblockRecipeLogic; +import gregicality.multiblocks.api.metatileentity.GCYMRecipeMapMultiblockController; +import gregicality.multiblocks.api.render.GCYMTextures; +import gregicality.multiblocks.common.block.GCYMMetaBlocks; +import gregicality.multiblocks.common.block.blocks.BlockLargeMultiblockCasing; +import gregicality.multiblocks.common.block.blocks.BlockUniqueCasing; +import gregtech.api.block.IHeatingCoilBlockStats; +import gregtech.api.capability.IHeatingCoil; +import gregtech.api.capability.IMufflerHatch; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.pattern.BlockPattern; +import gregtech.api.pattern.FactoryBlockPattern; +import gregtech.api.pattern.PatternMatchContext; +import gregtech.api.pattern.TraceabilityPredicate; +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMaps; +import gregtech.api.recipes.logic.OverclockingLogic; +import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage; +import gregtech.api.recipes.recipeproperties.TemperatureProperty; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; +import gregtech.api.util.GTUtility; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.client.renderer.texture.cube.OrientedOverlayRenderer; +import gregtech.common.blocks.*; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +public class MetaTileEntityAdvancedMegaBlastFurnace extends GCYMRecipeMapMultiblockController { + + public MetaTileEntityAdvancedMegaBlastFurnace(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, RecipeMaps.BLAST_RECIPES); + this.recipeMapWorkable = new MetaTileEntityAdvancedMegaBlastFurnace.AdvancedMegaBlastFurnaceRecipeLogic(this); + } + + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHolder) { + return new MetaTileEntityAdvancedMegaBlastFurnace(this.metaTileEntityId); + } + + protected void addDisplayText(List textList) { + if (this.isStructureFormed()) { + FluidStack liquidHeliumStack = getInputFluidInventory().drain(Materials.LiquidHelium.getFluid(Integer.MAX_VALUE), false); + int estimatedTemp = BlockWireCoil.CoilType.TRITANIUM.getCoilTemperature() + 100 * Math.max(0, GTUtility.getTierByVoltage(this.getEnergyContainer().getInputVoltage()) - 2) + (liquidHeliumStack == null ? 0 : liquidHeliumStack.amount); + textList.add((new TextComponentTranslation("gtexpert.multiblock.mega_blast_furnace.max_temperature", new Object[]{estimatedTemp})).setStyle((new Style()).setColor(TextFormatting.RED))); + } + + super.addDisplayText(textList); + } + + protected void formStructure(PatternMatchContext context) { + super.formStructure(context); + } + + public void invalidateStructure() { + super.invalidateStructure(); + } + + public boolean checkRecipe(@Nonnull Recipe recipe, boolean consumeIfSuccess) { + FluidStack liquidHeliumStack = this.getInputFluidInventory().drain(Materials.LiquidHelium.getFluid(Integer.MAX_VALUE), false); + return liquidHeliumStack != null && liquidHeliumStack.amount > 0; + } + + protected BlockPattern createStructurePattern() { + TraceabilityPredicate casing = states(new IBlockState[]{getCasingState()}).setMinGlobalLimited(360); + return FactoryBlockPattern.start().aisle(new String[]{"##XXXXXXXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############"}).aisle(new String[]{"#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FHPHAAAHPHF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "#FHPHAAAHPHF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "##TPPPMPPPT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##"}).aisle(new String[]{"XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###"}).aisle(new String[]{"#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############"}).aisle(new String[]{"##XXXXXXXXX##", "##XXXXSXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############"}).where('S', this.selfPredicate()).where('X', casing.or(this.autoAbilities(true, true, true, true, true, true, false))).where('F', frames(new Material[]{Materials.NaquadahAlloy})).where('H', casing).where('P', states(new IBlockState[]{getPipeState()})).where('B', states(new IBlockState[]{getFireboxState()})).where('I', states(new IBlockState[]{getIntakeState()})).where('T', states(new IBlockState[]{getCasingState2()})).where('V', states(new IBlockState[]{getVentState()})).where('M', abilities(new MultiblockAbility[]{MultiblockAbility.MUFFLER_HATCH})).where('C', states(MetaBlocks.FUSION_CASING.getState(BlockFusionCasing.CasingType.FUSION_CASING_MK3))).where('A', air()).where('#', any()).build(); + } + + private static IBlockState getCasingState() { + return GCYMMetaBlocks.LARGE_MULTIBLOCK_CASING.getState(BlockLargeMultiblockCasing.CasingType.HIGH_TEMPERATURE_CASING); + } + + private static IBlockState getCasingState2() { + return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.TUNGSTENSTEEL_ROBUST); + } + + private static IBlockState getFireboxState() { + return MetaBlocks.BOILER_FIREBOX_CASING.getState(BlockFireboxCasing.FireboxCasingType.TUNGSTENSTEEL_FIREBOX); + } + + private static IBlockState getIntakeState() { + return MetaBlocks.MULTIBLOCK_CASING.getState(BlockMultiblockCasing.MultiblockCasingType.EXTREME_ENGINE_INTAKE_CASING); + } + + private static IBlockState getPipeState() { + return MetaBlocks.BOILER_CASING.getState(BlockBoilerCasing.BoilerCasingType.TUNGSTENSTEEL_PIPE); + } + + private static IBlockState getVentState() { + return GCYMMetaBlocks.UNIQUE_CASING.getState(BlockUniqueCasing.UniqueCasingType.HEAT_VENT); + } + + public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { + super.addInformation(stack, player, tooltip, advanced); + tooltip.add(I18n.format("gtexpert.machine.electric_blast_furnace.tooltip.1", new Object[0])); + tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.1", new Object[0])); + tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.2", new Object[0])); + tooltip.add(I18n.format("gregtech.machine.electric_blast_furnace.tooltip.3", new Object[0])); + } + + public ICubeRenderer getBaseTexture(IMultiblockPart iMultiblockPart) { + return iMultiblockPart instanceof IMufflerHatch ? Textures.ROBUST_TUNGSTENSTEEL_CASING : GCYMTextures.BLAST_CASING; + } + + @Nonnull + protected OrientedOverlayRenderer getFrontOverlay() { + return GCYMTextures.MEGA_BLAST_FURNACE_OVERLAY; + } + + public boolean hasMufflerMechanics() { + return true; + } + + public boolean canBeDistinct() { + return true; + } + + private class AdvancedMegaBlastFurnaceRecipeLogic extends GCYMMultiblockRecipeLogic { + + public AdvancedMegaBlastFurnaceRecipeLogic(RecipeMapMultiblockController metaTileEntity) { + super(metaTileEntity); + } + + @Nonnull + protected int[] runOverclockingLogic(@Nonnull IRecipePropertyStorage propertyStorage, int recipeEUt, long maxVoltage, int duration, int maxOverclocks) { + FluidStack liquidHeliumStack = this.getMetaTileEntity().getInputFluidInventory().drain(Materials.LiquidHelium.getFluid(Integer.MAX_VALUE), true); + int currentTemp = BlockWireCoil.CoilType.TRITANIUM.getCoilTemperature() + 100 * Math.max(0, GTUtility.getTierByVoltage(this.getEnergyContainer().getInputVoltage()) - 2) + (liquidHeliumStack == null ? 0 : liquidHeliumStack.amount); + return OverclockingLogic.heatingCoilOverclockingLogic(Math.abs(recipeEUt), maxVoltage, duration, maxOverclocks, currentTemp, (Integer) propertyStorage.getRecipePropertyValue(TemperatureProperty.getInstance(), 0)); + } + } +} diff --git a/src/main/resources/assets/gtexpert/lang/en_us.lang b/src/main/resources/assets/gtexpert/lang/en_us.lang index 04147b34..b66b5eec 100644 --- a/src/main/resources/assets/gtexpert/lang/en_us.lang +++ b/src/main/resources/assets/gtexpert/lang/en_us.lang @@ -18,6 +18,9 @@ gtexpert.machine.draconium_fusion.tooltip=It feels strong and powerful? gtexpert.machine.draconium_fusion.tooltip.1=§dAuthor:§f @miozune, @tier940 gtexpert.machine.awakened_draconium_fusion.name=Draconic Fusion Crafter II gtexpert.machine.awakened_draconium_fusion.tooltip=It feels strong and powerful? +gtexpert.machine.advanced_mega_blast_furnace.name=Advanced Mega Blast Furnace +gtexpert.machine.advanced_mega_blast_furnace.tooltip=§dAuthor:§f @Quarri6343 +gtexpert.machine.electric_blast_furnace.tooltip.1=1mb Liquid Helium = 1K Temp. # singleblock # Vial Extractor @@ -157,3 +160,4 @@ recipemap.draconic_fusion_upgrade.property.2= and stored energy #misc gtexpert.multiblock.needsun=The Controller must be able to See the Sun! +gtexpert.multiblock.mega_blast_furnace.max_temperature=Estimated Current Temperature: %s diff --git a/src/main/resources/assets/gtexpert/lang/ja_jp.lang b/src/main/resources/assets/gtexpert/lang/ja_jp.lang index e83c815b..67765655 100644 --- a/src/main/resources/assets/gtexpert/lang/ja_jp.lang +++ b/src/main/resources/assets/gtexpert/lang/ja_jp.lang @@ -18,6 +18,9 @@ gtexpert.machine.draconium_fusion.tooltip=なんだか強そうですね? gtexpert.machine.draconium_fusion.tooltip.1=§d作者:§f @miozune, @tier940 gtexpert.machine.awakened_draconium_fusion.name=ドラコニック融合機 II gtexpert.machine.awakened_draconium_fusion.tooltip=なんだか強そうですね? +gtexpert.machine.advanced_mega_blast_furnace.name=無限加熱高炉 +gtexpert.machine.advanced_mega_blast_furnace.tooltip=§d作者:§f @Quarri6343 +gtexpert.machine.electric_blast_furnace.tooltip.1=液体ヘリウムを1mb入れると温度が1K上がる。 # singleblock # Vial Extractor @@ -157,4 +160,5 @@ recipemap.draconic_fusion_upgrade.property.2= 保持されます #misc gtexpert.multiblock.needsun=コントローラーは必ず空に面する必要があります! +gtexpert.multiblock.mega_blast_furnace.max_temperature=次回稼働予測温度: %s