Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trainvoi committed Oct 21, 2024
1 parent e093c33 commit c19512b
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -34,28 +37,47 @@
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())
.where('P', states(getPipeCasingState()))
.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();
}
Expand All @@ -74,6 +96,8 @@ protected static IBlockState getGearboxState() {
}

public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> 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]));
}
Expand All @@ -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;
}
}

}
3 changes: 3 additions & 0 deletions src/main/resources/assets/susy/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c19512b

Please sign in to comment.