Improved IGrinderRegistry (#3110)
* Improved IGrinderRegistry Added a builder for grinder recipes similar to IInscriberRegistry. Replaced different add methods with this builder. IIinscriberRegistry#addRecipe and removeRecipe now return true on success.
This commit is contained in:
@@ -58,6 +58,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
@@ -96,12 +99,26 @@ public class IMCGrinder implements IIMCProcessor
|
||||
}
|
||||
|
||||
final float chance = msg.getFloat( "chance" );
|
||||
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||
.withOutput( out )
|
||||
.withFirstOptional( optional, chance )
|
||||
.withTurns( turns )
|
||||
.build();
|
||||
|
||||
AEApi.instance().registries().grinder().addRecipe( in, out, optional, chance, turns );
|
||||
grinderRegistry.addRecipe( grinderRecipe );
|
||||
}
|
||||
else
|
||||
{
|
||||
AEApi.instance().registries().grinder().addRecipe( in, out, turns );
|
||||
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( in )
|
||||
.withOutput( out )
|
||||
.withTurns( turns )
|
||||
.build();
|
||||
|
||||
grinderRegistry.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
@@ -33,7 +35,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRecipeBuilder;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.ores.IOreListener;
|
||||
@@ -83,58 +88,26 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
OreDictionaryHandler.INSTANCE.observe( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder builder()
|
||||
{
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addRecipe( IGrinderRecipe recipe )
|
||||
{
|
||||
Preconditions.checkNotNull( recipe, "Cannot add null as recipe." );
|
||||
|
||||
return this.injectRecipe( recipe );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IGrinderRecipe> getRecipes()
|
||||
{
|
||||
return Collections.unmodifiableCollection( this.recipes.values() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( final ItemStack in, final ItemStack out, final int cost )
|
||||
{
|
||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
||||
|
||||
this.log( "Allow Grinding of '%1$s' to '%2$s' for %3$d turn", Platform.getItemDisplayName( in ), Platform.getItemDisplayName( out ), cost );
|
||||
|
||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( final ItemStack in, final ItemStack out, final ItemStack optional, final float chance, final int cost )
|
||||
{
|
||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
||||
Preconditions.checkNotNull( optional, "Null is not accepted as optional itemstack." );
|
||||
Preconditions.checkArgument( chance >= 0.0 && chance <= 1.0, "chance must be within 0.0 - 1.0." );
|
||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
||||
|
||||
this.log( "Allow Grinding of '%1$s' to '%2$s' with optional '%3$s' @ %4$.2f for %5$d", Platform.getItemDisplayName( in ),
|
||||
Platform.getItemDisplayName( out ), Platform.getItemDisplayName( optional ), chance, cost );
|
||||
|
||||
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( final ItemStack in, final ItemStack out, final ItemStack optional1, final float chance1, final ItemStack optional2, final float chance2, final int cost )
|
||||
{
|
||||
Preconditions.checkNotNull( in, "Null is not accepted as input itemstack." );
|
||||
Preconditions.checkNotNull( out, "Null is not accepted as output itemstack." );
|
||||
Preconditions.checkNotNull( optional1, "Null is not accepted as optional itemstack." );
|
||||
Preconditions.checkArgument( chance1 >= 0.0 && chance1 <= 1.0, "chance must be within 0.0 - 1.0." );
|
||||
Preconditions.checkNotNull( optional2, "Null is not accepted as optional2 itemstack." );
|
||||
Preconditions.checkArgument( chance2 >= 0.0 && chance2 <= 1.0, "chance2 must be within 0.0 - 1.0." );
|
||||
Preconditions.checkArgument( cost > 0, "Turns must be > 0" );
|
||||
|
||||
this.log( "Allow Grinding of '%1$s' to '%2$s' with optional '%3$s' @ %4$.2f and optional2 '%5$s' @ %6$.2f for %7$d", Platform.getItemDisplayName( in ),
|
||||
Platform.getItemDisplayName( out ), Platform.getItemDisplayName( optional1 ), chance1, Platform.getItemDisplayName( optional2 ), chance2,
|
||||
cost );
|
||||
|
||||
this.injectRecipe(
|
||||
new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional1 ), this.copy( optional2 ), chance1, chance2, cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeRecipe( IGrinderRecipe recipe )
|
||||
{
|
||||
@@ -214,26 +187,19 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
}
|
||||
}
|
||||
|
||||
private void injectRecipe( final AppEngGrinderRecipe appEngGrinderRecipe )
|
||||
private boolean injectRecipe( final IGrinderRecipe grinderRecipe )
|
||||
{
|
||||
final CacheKey cacheKey = new CacheKey( appEngGrinderRecipe.getInput() );
|
||||
final CacheKey cacheKey = new CacheKey( grinderRecipe.getInput() );
|
||||
|
||||
if( this.recipes.containsKey( cacheKey ) )
|
||||
{
|
||||
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( appEngGrinderRecipe.getInput() ) );
|
||||
return;
|
||||
this.log( "Tried to add duplicate recipe for '%1$s'", Platform.getItemDisplayName( grinderRecipe.getInput() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
this.recipes.put( cacheKey, appEngGrinderRecipe );
|
||||
}
|
||||
this.recipes.put( cacheKey, grinderRecipe );
|
||||
|
||||
private ItemStack copy( final ItemStack is )
|
||||
{
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
return is.copy();
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getDustToOreRatio( final String name )
|
||||
@@ -259,11 +225,25 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
final ItemStack extra = is.copy();
|
||||
extra.setCount( ratio - 1 );
|
||||
this.addRecipe( item, is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 );
|
||||
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||
.withOutput( is )
|
||||
.withFirstOptional( extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ) )
|
||||
.withTurns( 8 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addRecipe( item, is, 8 );
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||
.withOutput( is )
|
||||
.withTurns( 8 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +260,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.addRecipe( item, this.dusts.get( name ), 4 );
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
IGrinderRecipe grinderRecipe = builder.withInput( item )
|
||||
.withOutput( this.dusts.get( name ) )
|
||||
.withTurns( 4 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,6 +276,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.dusts.containsKey( name ) )
|
||||
{
|
||||
this.log( "Rejecting Dust: '%1$s'", Platform.getItemDisplayName( item ) );
|
||||
@@ -311,11 +298,25 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
final ItemStack extra = is.copy();
|
||||
extra.setCount( ratio - 1 );
|
||||
this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ), 8 );
|
||||
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||
.withOutput( is )
|
||||
.withFirstOptional( extra, (float) ( AEConfig.instance().getOreDoublePercentage() / 100.0 ) )
|
||||
.withTurns( 8 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addRecipe( d.getKey(), is, 8 );
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||
.withOutput( is )
|
||||
.withTurns( 8 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,7 +325,13 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
if( name.equals( d.getValue() ) )
|
||||
{
|
||||
this.addRecipe( d.getKey(), item, 4 );
|
||||
final IGrinderRecipeBuilder builder = this.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( d.getKey() )
|
||||
.withOutput( item )
|
||||
.withTurns( 4 )
|
||||
.build();
|
||||
|
||||
this.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,7 +372,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if( obj == null || this.getClass() != obj.getClass() )
|
||||
if( obj == null || getClass() != obj.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -393,4 +400,100 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal {@link IInscriberRecipeBuilder} implementation.
|
||||
* Needs to be adapted to represent a correct {@link IInscriberRecipe}
|
||||
*/
|
||||
private static final class Builder implements IGrinderRecipeBuilder
|
||||
{
|
||||
|
||||
private ItemStack in;
|
||||
private ItemStack out;
|
||||
|
||||
private float optionalChance;
|
||||
private ItemStack optionalOutput;
|
||||
|
||||
private float optionalChance2;
|
||||
private ItemStack optionalOutput2;
|
||||
|
||||
private int turns = 8;
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder withInput( ItemStack input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkArgument( !input.isEmpty(), "Input cannot be empty." );
|
||||
|
||||
this.in = this.copy( input );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder withOutput( ItemStack output )
|
||||
{
|
||||
Preconditions.checkNotNull( output );
|
||||
Preconditions.checkArgument( !output.isEmpty(), "Output cannot be empty." );
|
||||
|
||||
this.out = this.copy( output );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder withFirstOptional( ItemStack optional, float chance )
|
||||
{
|
||||
Preconditions.checkNotNull( optional );
|
||||
Preconditions.checkArgument( !optional.isEmpty(), "Optional cannot be empty." );
|
||||
Preconditions.checkArgument( chance >= 0 && chance <= 1.0 );
|
||||
|
||||
this.optionalOutput = this.copy( optional );
|
||||
this.optionalChance = chance;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder withSecondOptional( ItemStack optional, float chance )
|
||||
{
|
||||
Preconditions.checkNotNull( optional );
|
||||
Preconditions.checkArgument( !optional.isEmpty(), "Optional cannot be empty." );
|
||||
Preconditions.checkArgument( chance >= 0 && chance <= 1.0 );
|
||||
|
||||
this.optionalOutput2 = this.copy( optional );
|
||||
this.optionalChance2 = chance;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderRecipeBuilder withTurns( int turns )
|
||||
{
|
||||
Preconditions.checkArgument( turns > 0 );
|
||||
|
||||
this.turns = turns;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IGrinderRecipe build()
|
||||
{
|
||||
Preconditions.checkState( this.in != null, "Input itemstack must be defined." );
|
||||
Preconditions.checkState( this.out != null, "Output itemstack must be defined." );
|
||||
|
||||
return new AppEngGrinderRecipe( this.in, this.out, this.optionalOutput, this.optionalOutput2, this.optionalChance, this.optionalChance2, this.turns );
|
||||
}
|
||||
|
||||
private ItemStack copy( final ItemStack is )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
return is.copy();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
@@ -84,32 +86,43 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe( final IInscriberRecipe recipe )
|
||||
public boolean addRecipe( final IInscriberRecipe recipe )
|
||||
{
|
||||
if( recipe == null )
|
||||
Preconditions.checkNotNull( recipe, "Tried to add (null) as inscriber recipe to the registry." );
|
||||
|
||||
if( this.recipes.add( recipe ) )
|
||||
{
|
||||
throw new IllegalArgumentException( "Tried to add an invalid (null) inscriber recipe to the registry." );
|
||||
this.recipes.add( recipe );
|
||||
|
||||
recipe.getTopOptional().ifPresent( this.optionals::add );
|
||||
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
||||
|
||||
this.inputs.addAll( recipe.getInputs() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
this.recipes.add( recipe );
|
||||
|
||||
recipe.getTopOptional().ifPresent( this.optionals::add );
|
||||
recipe.getBottomOptional().ifPresent( this.optionals::add );
|
||||
|
||||
this.inputs.addAll( recipe.getInputs() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRecipe( final IInscriberRecipe toBeRemovedRecipe )
|
||||
public boolean removeRecipe( final IInscriberRecipe toBeRemovedRecipe )
|
||||
{
|
||||
Preconditions.checkNotNull( toBeRemovedRecipe, "Tried to remove (null) from the registry." );
|
||||
|
||||
boolean changed = false;
|
||||
|
||||
for( final Iterator<IInscriberRecipe> iterator = this.recipes.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
final IInscriberRecipe recipe = iterator.next();
|
||||
if( recipe.equals( toBeRemovedRecipe ) )
|
||||
{
|
||||
changed = true;
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +141,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withInputs( @Nonnull final Collection<ItemStack> inputs )
|
||||
{
|
||||
Preconditions.checkNotNull( inputs );
|
||||
Preconditions.checkArgument( !inputs.isEmpty() );
|
||||
|
||||
this.inputs = new ArrayList<>( inputs.size() );
|
||||
this.inputs.addAll( inputs );
|
||||
|
||||
@@ -138,6 +154,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withOutput( @Nonnull final ItemStack output )
|
||||
{
|
||||
Preconditions.checkNotNull( output );
|
||||
Preconditions.checkArgument( !output.isEmpty() );
|
||||
|
||||
this.output = output;
|
||||
|
||||
return this;
|
||||
@@ -147,6 +166,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withTopOptional( @Nonnull final ItemStack topOptional )
|
||||
{
|
||||
Preconditions.checkNotNull( topOptional );
|
||||
Preconditions.checkArgument( !topOptional.isEmpty() );
|
||||
|
||||
this.topOptional = topOptional;
|
||||
|
||||
return this;
|
||||
@@ -156,6 +178,9 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withBottomOptional( @Nonnull final ItemStack bottomOptional )
|
||||
{
|
||||
Preconditions.checkNotNull( bottomOptional );
|
||||
Preconditions.checkArgument( !bottomOptional.isEmpty() );
|
||||
|
||||
this.bottomOptional = bottomOptional;
|
||||
|
||||
return this;
|
||||
@@ -165,6 +190,8 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public Builder withProcessType( @Nonnull final InscriberProcessType type )
|
||||
{
|
||||
Preconditions.checkNotNull( type );
|
||||
|
||||
this.type = type;
|
||||
|
||||
return this;
|
||||
@@ -174,26 +201,11 @@ public final class InscriberRegistry implements IInscriberRegistry
|
||||
@Override
|
||||
public IInscriberRecipe build()
|
||||
{
|
||||
if( this.inputs == null )
|
||||
{
|
||||
throw new IllegalStateException( "Input must be defined." );
|
||||
}
|
||||
if( this.inputs.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "Input must have a size." );
|
||||
}
|
||||
if( this.output.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "Output must be defined." );
|
||||
}
|
||||
if( this.topOptional.isEmpty() && this.bottomOptional.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "One optional must be defined." );
|
||||
}
|
||||
if( this.type == null )
|
||||
{
|
||||
throw new IllegalStateException( "Process type must be defined." );
|
||||
}
|
||||
Preconditions.checkState( this.inputs != null, "Input must be defined." );
|
||||
Preconditions.checkState( !this.inputs.isEmpty(), "Input must have a size." );
|
||||
Preconditions.checkState( !this.output.isEmpty(), "Output cannot be empty." );
|
||||
Preconditions.checkState( !this.topOptional.isEmpty() || !this.bottomOptional.isEmpty(), "One optional must be defined." );
|
||||
Preconditions.checkState( this.type != null, "Process type must be defined." );
|
||||
|
||||
return new InscriberRecipe( this.inputs, this.output, this.topOptional, this.bottomOptional, this.type );
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
import appeng.api.features.IGrinderRecipeBuilder;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
@@ -60,7 +63,14 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
|
||||
{
|
||||
for( final ItemStack is : this.pro_input.getItemStackSet() )
|
||||
{
|
||||
AEApi.instance().registries().grinder().addRecipe( is, this.pro_output[0].getItemStack(), 8 );
|
||||
final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder();
|
||||
final IGrinderRecipeBuilder builder = grinderRegistry.builder();
|
||||
final IGrinderRecipe grinderRecipe = builder.withInput( is )
|
||||
.withOutput( this.pro_output[0].getItemStack() )
|
||||
.withTurns( 8 )
|
||||
.build();
|
||||
|
||||
grinderRegistry.addRecipe( grinderRecipe );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user