-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
33 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/main/java/supersymmetry/api/capability/impl/BiomeRecipeLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters