API Synced with Grinder canges.
This commit is contained in:
parent
af3a9f29b6
commit
fdc263702e
3 changed files with 54 additions and 1 deletions
|
@ -96,6 +96,20 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
|
|||
injectRecipe( new AppEngGrinderRecipe( copy( in ), copy( out ), copy( optional ), chance, cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost)
|
||||
{
|
||||
if ( in == null || (optional == null && out == null && optional2 == null) )
|
||||
{
|
||||
log( "Invalid Grinder Recipe Specified." );
|
||||
return;
|
||||
}
|
||||
|
||||
log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
|
||||
+ Platform.getItemDisplayName( optional ) + " for " + cost );
|
||||
injectRecipe( new AppEngGrinderRecipe( copy( in ), copy( out ), copy( optional ), chance, cost ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrinderEntry getRecipeForInput(ItemStack input)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,9 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
|||
private float optionalChance;
|
||||
private ItemStack optionalOutput;
|
||||
|
||||
private float optionalChance2;
|
||||
private ItemStack optionalOutput2;
|
||||
|
||||
private int energy;
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, int cost) {
|
||||
|
@ -30,6 +33,19 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
|||
energy = cost;
|
||||
}
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, ItemStack c, ItemStack d, float chance, float chance2, int cost) {
|
||||
in = a;
|
||||
out = b;
|
||||
|
||||
optionalOutput = c;
|
||||
optionalChance = chance;
|
||||
|
||||
optionalOutput2 = d;
|
||||
optionalChance2 = chance2;
|
||||
|
||||
energy = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getInput()
|
||||
{
|
||||
|
@ -75,7 +91,7 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
|||
@Override
|
||||
public void setOptionalOutput(ItemStack output, float chance)
|
||||
{
|
||||
optionalOutput = output;
|
||||
optionalOutput = output.copy();
|
||||
optionalChance = chance;
|
||||
}
|
||||
|
||||
|
@ -85,4 +101,23 @@ public class AppEngGrinderRecipe implements IGrinderEntry
|
|||
return optionalChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSecondOptionalOutput()
|
||||
{
|
||||
return optionalOutput2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondOptionalOutput(ItemStack output, float chance)
|
||||
{
|
||||
optionalChance2 = chance;
|
||||
optionalOutput2 = output.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSecondOptionalChance()
|
||||
{
|
||||
return optionalChance2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -144,6 +144,10 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
|||
if ( chance <= r.getOptionalChance() )
|
||||
addItem( sia, r.getOptionalOutput() );
|
||||
|
||||
chance = (Platform.getRandomInt() % 2000) / 2000.0f;
|
||||
if ( chance <= r.getSecondOptionalChance() )
|
||||
addItem( sia, r.getSecondOptionalOutput() );
|
||||
|
||||
this.setInventorySlotContents( 6, null );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue