Skip to content

Commit

Permalink
Merge pull request #81 from repo-alt/master
Browse files Browse the repository at this point in the history
Make grinder recipes just as optional as the grinder itself
  • Loading branch information
Dream-Master authored Dec 9, 2021
2 parents fe8e876 + c91b1bf commit 450c2b9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/main/java/appeng/core/api/imc/IMCGrinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@


import appeng.api.AEApi;
import appeng.core.AEConfig;
import appeng.core.api.IIMCProcessor;
import appeng.core.features.AEFeature;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand All @@ -65,6 +67,8 @@ public class IMCGrinder implements IIMCProcessor
@Override
public void process( final IMCMessage m )
{
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.GrindStone ) )
throw new IllegalStateException( "Grindstone is disabled" );
final NBTTagCompound msg = m.getNBTValue();
final NBTTagCompound inTag = (NBTTagCompound) msg.getTag( "in" );
final NBTTagCompound outTag = (NBTTagCompound) msg.getTag( "out" );
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/appeng/integration/modules/NEI.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ public void init() throws Throwable
this.registerRecipeHandler( new NEIAEShapelessRecipeHandler() );
this.registerRecipeHandler( new NEIInscriberRecipeHandler() );
this.registerRecipeHandler( new NEIWorldCraftingHandler() );
this.registerRecipeHandler( new NEIGrinderRecipeHandler() );

if ( AEConfig.instance.isFeatureEnabled( AEFeature.GrindStone ) )
{
this.registerRecipeHandler(new NEIGrinderRecipeHandler());
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.EnableFacadeCrafting ) )
{
this.registerRecipeHandler( new NEIFacadeRecipeHandler() );
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/appeng/recipes/handlers/Grind.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -57,9 +59,12 @@ public void setup( final List<List<IIngredient>> input, final List<List<IIngredi
@Override
public void register() throws RegistrationError, MissingIngredientError
{
for( final ItemStack is : this.pro_input.getItemStackSet() )
if ( AEConfig.instance.isFeatureEnabled( AEFeature.GrindStone ) )
{
AEApi.instance().registries().grinder().addRecipe( is, this.pro_output[0].getItemStack(), 8 );
for (final ItemStack is : this.pro_input.getItemStackSet())
{
AEApi.instance().registries().grinder().addRecipe(is, this.pro_output[0].getItemStack(), 8);
}
}
}

Expand Down

0 comments on commit 450c2b9

Please sign in to comment.