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 f7e6768 commit 3a55f7d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package supersymmetry.api.capability.impl;

import gregtech.api.capability.impl.MultiblockRecipeLogic;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.recipes.Recipe;
import org.jetbrains.annotations.NotNull;
import supersymmetry.api.recipes.properties.BiomeProperty;

/**
* 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 class BiomeRecipeLogic extends MultiblockRecipeLogic {

public BiomeRecipeLogic(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);
}
/**
* This is a method for biome checking
*/
public boolean checkBiomeRequirement(@NotNull Recipe recipe) {
if (!recipe.hasProperty(BiomeProperty.getInstance())) return true;
return recipe.getProperty(BiomeProperty.getInstance(), BiomeProperty.BiomePropertyList.EMPTY_LIST)
.checkBiome(getMetaTileEntity().getWorld().getBiome(getMetaTileEntity().getPos()));
}

@Override
public int getParallelLimit() {
return 256;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType;
import gregtech.common.blocks.BlockTurbineCasing.TurbineCasingType;
import gregtech.common.blocks.MetaBlocks;
import net.minecraft.block.state.BlockWorldState;
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.world.World;
import org.jetbrains.annotations.NotNull;
import supersymmetry.api.capability.impl.BiomeRecipeLogic;
import supersymmetry.api.recipes.SuSyRecipeMaps;
import supersymmetry.api.recipes.properties.BiomeProperty;
import supersymmetry.client.renderer.textures.SusyTextures;
Expand All @@ -44,8 +46,19 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
return new MetaTileEntityLargeFluidPump(this.metaTileEntityId);
}

@Override
public boolean isMultiblockPartWeatherResistant(@Nonnull IMultiblockPart part) {
return true;
}

public boolean checkHeightRequirement() {
return this.getPos().getY() == 64;
}


protected @NotNull BlockPattern createStructurePattern() {
return FactoryBlockPattern.start(RIGHT, FRONT, UP)
.aisle(" ", " P", " ")
.aisle(" ", " P", " ")
.aisle("FCCCC ", "CCCCC P", "FCECC ")
.aisle("CCSGC ", "OPPPPPP", "CCECC ")
Expand Down Expand Up @@ -79,42 +92,14 @@ protected static IBlockState getGearboxState() {

public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.multiblock.large_fluid_pump.tooltip.1"));
tooltip.add(I18n.format("gregtech.multiblock.large_fluid_pump.tooltip.2"));
tooltip.add(TooltipHelper.RAINBOW_SLOW + I18n.format("gregtech.machine.perfect_oc", new Object[0]));
}
/**
* 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 BiomeRecipeLogic extends MultiblockRecipeLogic {

public BiomeRecipeLogic(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 checkBiomeRequirement(recipe) && super.checkRecipe(recipe);
}

/**
* This is a method for biome checking
*/
public boolean checkBiomeRequirement(@NotNull Recipe recipe) {
if (!recipe.hasProperty(BiomeProperty.getInstance())) return true;
return recipe.getProperty(BiomeProperty.getInstance(), BiomeProperty.BiomePropertyList.EMPTY_LIST)
.checkBiome(getMetaTileEntity().getWorld().getBiome(getMetaTileEntity().getPos()));
}

@Override
public int getParallelLimit() {
return 256;
}
@Override
public void checkStructurePattern() {
super.checkStructurePattern();
}

@Nonnull
Expand Down
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=Only works when the controller is at Y=64
gregtech.machine.large_fluid_pump.tooltip.1=This would definitely affect the local trout population.
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 3a55f7d

Please sign in to comment.