From c19512b1b57c3dc26091581983a9b7ae4b076580 Mon Sep 17 00:00:00 2001 From: trainvoi Date: Sun, 20 Oct 2024 21:31:36 +0700 Subject: [PATCH] commit --- .../SuSyMetaTileEntities.java | 4 +- .../MetaTileEntityLargeFluidPump.java | 74 ++++++++++++++++++- .../resources/assets/susy/lang/en_us.lang | 3 + 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index f0ba1a580..2fa522e27 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -261,8 +261,6 @@ public static void init() { FLARE_STACK = registerMetaTileEntity(17007, new MetaTileEntityFlareStack(susyId("flare_stack"))); FROTH_FLOTATION_TANK = registerMetaTileEntity(17008, new MetaTileEntityFrothFlotationTank(susyId("froth_flotation_tank"))); MULTI_STAGE_FLASH_DISTILLER = registerMetaTileEntity(17009, new MetaTileEntityMultiStageFlashDistiller(susyId("multi_stage_flash_distiller"))); - - LARGE_FLUID_PUMP = registerMetaTileEntity(17021, new MetaTileEntityLargeFluidPump(susyId("large_fluid_pump"))); OCEAN_PUMPER = registerMetaTileEntity(17011, new MetaTileEntityOceanPumper(susyId("ocean_pumper"))); HIGH_TEMPERATURE_DISTILLATION_TOWER = registerMetaTileEntity(17012, new MetaTileEntityHighTemperatureDistillationTower(susyId("high_temperature_distillation_tower"))); ROTARY_KILN = registerMetaTileEntity(17013, new MetaTileEntityRotaryKiln(susyId("rotary_kiln"))); @@ -275,6 +273,8 @@ public static void init() { PHASE_SEPARATOR[0] = registerMetaTileEntity(17018, new MetaTileEntityPhaseSeparator(susyId("phase_separator"))); BATH_CONDENSER[0] = registerMetaTileEntity(17019, new MetaTileEntityBathCondenser(susyId("bath_condenser"))); + LARGE_FLUID_PUMP = registerMetaTileEntity(17021, new MetaTileEntityLargeFluidPump(susyId("large_fluid_pump"))); + registerSimpleMTE(ELECTROSTATIC_SEPARATOR, 12, 17035, "electrostatic_separator", SuSyRecipeMaps.ELECTROSTATIC_SEPARATOR, SusyTextures.ELECTROSTATIC_SEPARATOR_OVERLAY, true, GTUtility.defaultTankSizeFunction); registerSimpleMTE(POLISHING_MACHINE, 12, 17048, "polishing_machine", SuSyRecipeMaps.POLISHING_MACHINE, SusyTextures.POLISHING_MACHINE_OVERLAY, true, GTUtility.defaultTankSizeFunction); registerSimpleMTE(TEXTILE_SPINNER, 12, 17061, "textile_spinner", SuSyRecipeMaps.SPINNING_RECIPES, SusyTextures.TEXTILE_SPINNER_OVERLAY, true); diff --git a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityLargeFluidPump.java b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityLargeFluidPump.java index b7cf6ba5a..79e460bcc 100644 --- a/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityLargeFluidPump.java +++ b/src/main/java/supersymmetry/common/metatileentities/multi/electric/MetaTileEntityLargeFluidPump.java @@ -8,6 +8,7 @@ import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; +import gregtech.api.recipes.Recipe; import gregtech.api.unification.material.Materials; import gregtech.client.renderer.ICubeRenderer; import gregtech.client.renderer.texture.Textures; @@ -20,9 +21,11 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; import supersymmetry.api.recipes.SuSyRecipeMaps; +import supersymmetry.api.recipes.properties.BiomeProperty; import supersymmetry.client.renderer.textures.SusyTextures; import javax.annotation.Nonnull; @@ -34,18 +37,36 @@ public class MetaTileEntityLargeFluidPump extends RecipeMapMultiblockController { public MetaTileEntityLargeFluidPump(ResourceLocation metaTileEntityId) { super(metaTileEntityId, SuSyRecipeMaps.PUMPING_RECIPES); - this.recipeMapWorkable = new MultiblockRecipeLogic(this, true); + + this.recipeMapWorkable = new LargePumpRecipeLogic(this); } public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { return new MetaTileEntityLargeFluidPump(this.metaTileEntityId); } + @Override + public boolean isMultiblockPartWeatherResistant(@Nonnull IMultiblockPart part) { + return true; + } + + @Override + public boolean getIsWeatherOrTerrainResistant() { + return true; + } + + @Override + public boolean allowsExtendedFacing() { + return false; + } + + protected @NotNull BlockPattern createStructurePattern() { return FactoryBlockPattern.start(RIGHT, FRONT, UP) + .aisle(" ", " P", " ") .aisle(" ", " P", " ") .aisle("FCCCC ", "CCCCC P", "FCECC ") - .aisle("CCSGC ", "OPPPPPP", "FCECC ") + .aisle("CCSGC ", "OPPPPPP", "CCECC ") .aisle("FCCC ", "CCCCC ", "FCEC ") .where(' ', any()) .where('S', selfPredicate()) @@ -53,9 +74,10 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { .where('G', states(getGearboxState())) .where('F', frames(Materials.Steel)) .where('C', states(getCasingState()) - .or(abilities(MultiblockAbility.IMPORT_ITEMS))) + .or(abilities(MultiblockAbility.IMPORT_ITEMS).setMaxGlobalLimited(1)) + .or(autoAbilities(true, false))) .where('E', states(getCasingState()) - .or(abilities(MultiblockAbility.INPUT_ENERGY))) + .or(abilities(MultiblockAbility.INPUT_ENERGY)).setMinGlobalLimited(1).setMaxGlobalLimited(2)) .where('O', abilities(MultiblockAbility.EXPORT_FLUIDS)) .build(); } @@ -74,6 +96,8 @@ protected static IBlockState getGearboxState() { } public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.machine.large_fluid_pump.tooltip.1")); + tooltip.add(I18n.format("gregtech.machine.large_fluid_pump.tooltip.2")); super.addInformation(stack, player, tooltip, advanced); tooltip.add(TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.perfect_oc", new Object[0])); } @@ -82,4 +106,46 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis protected ICubeRenderer getFrontOverlay() { return SusyTextures.OCEANIC_DRILL_OVERLAY; } + + /** + * A custom recipeLogic class, for adding our check for biomes + * This can be moved out to a stand-alone class. + * But generally speaking if you do not plan to re-use this, making it an inner class should be fine. + * CEu itself has many such cases. + */ + public static class LargePumpRecipeLogic extends MultiblockRecipeLogic { + + public LargePumpRecipeLogic(RecipeMapMultiblockController tileEntity) { + super(tileEntity, true); + } + + + /** + * Overriding this to add our own custom checks + * Don't forget super calls + */ + @Override + public boolean checkRecipe(@NotNull Recipe recipe) { + return checkHeightRequirement() && checkBiomeRequirement(recipe) && super.checkRecipe(recipe); + } + + public boolean checkHeightRequirement() { + return getMetaTileEntity().getPos().getY() == 64; + } + /** + * This is a method for biome checking + */ + public boolean checkBiomeRequirement(@NotNull Recipe recipe) { + if (!recipe.hasProperty(BiomeProperty.getInstance())) return true; + BlockPos tempPos = getMetaTileEntity().getPos(); + return recipe.getProperty(BiomeProperty.getInstance(), BiomeProperty.BiomePropertyList.EMPTY_LIST) + .checkBiome(getMetaTileEntity().getWorld().getBiome(getMetaTileEntity().getPos())); + } + + @Override + public int getParallelLimit() { + return 256; + } + } + } diff --git a/src/main/resources/assets/susy/lang/en_us.lang b/src/main/resources/assets/susy/lang/en_us.lang index 909a59bd1..15fbcd4de 100644 --- a/src/main/resources/assets/susy/lang/en_us.lang +++ b/src/main/resources/assets/susy/lang/en_us.lang @@ -256,6 +256,9 @@ gregtech.machine.primitive_mud_pump.name=Primitive Mud Pump gregtech.machine.primitive_mud_pump.tooltip=Works only in River biomes between Y=64 and Y=80 gregtech.machine.basic_steam_turbine.name=Large Steam Turbine gregtech.machine.basic_gas_turbine.name=Large Gas Turbine +gregtech.machine.large_fluid_pump.name=Large Fluid Pump +gregtech.machine.large_fluid_pump.tooltip.1=This would definitely affect the local trout population. +gregtech.machine.large_fluid_pump.tooltip.2=Only works when the controller is at Y=64 gregtech.machine.ocean_pumper.name=Ocean Pumper gregtech.machine.ocean_pumper.tooltip=Works only in Ocean biomes between Y=70 and Y=75 gregtech.machine.advanced_arc_furnace.name=Advanced Arc Furnace