Merge pull request #1029 from thatsIch/e-1024-zinc

Fixes #1024 Added zinc to the grindstone, which is part of Flaxbeards Steam Power (FSP)
This commit is contained in:
thatsIch 2015-03-15 18:38:03 +01:00
commit 4744dfab78
2 changed files with 58 additions and 56 deletions

View file

@ -128,7 +128,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
// AE
"CertusQuartz", "Wheat", "Fluix",
// Other Mod Ores
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" };
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
public double oreDoublePercentage = 90.0;

View file

@ -18,6 +18,7 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -37,20 +38,20 @@ import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
import appeng.util.Platform;
public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
public final class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{
private final List<IGrinderEntry> recipes;
private final Map<ItemStack, String> ores;
private final Map<ItemStack, String> ingots;
private final Map<String, ItemStack> dusts;
public final List<IGrinderEntry> RecipeList;
private ItemStack copy(ItemStack is)
public GrinderRecipeManager()
{
if ( is != null )
return is.copy();
return null;
}
public GrinderRecipeManager() {
this.RecipeList = new ArrayList<IGrinderEntry>();
this.recipes = new ArrayList<IGrinderEntry>();
this.ores = new HashMap<ItemStack, String>();
this.ingots = new HashMap<ItemStack, String>();
this.dusts = new HashMap<String, ItemStack>();
this.addOre( "Coal", new ItemStack( Items.coal ) );
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
@ -78,16 +79,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
public List<IGrinderEntry> getRecipes()
{
this.log( "API - getRecipes" );
return this.RecipeList;
}
private void injectRecipe(AppEngGrinderRecipe appEngGrinderRecipe)
{
for (IGrinderEntry gr : this.RecipeList)
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
return;
this.RecipeList.add( appEngGrinderRecipe );
return this.recipes;
}
@Override
@ -112,8 +104,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return;
}
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
}
@ -126,18 +117,33 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return;
}
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional "
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
}
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
{
for ( IGrinderEntry gr : this.recipes )
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
return;
this.recipes.add( appEngGrinderRecipe );
}
private ItemStack copy( ItemStack is )
{
if ( is != null )
return is.copy();
return null;
}
@Override
public IGrinderEntry getRecipeForInput( ItemStack input )
{
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
if ( input != null )
{
for (IGrinderEntry r : this.RecipeList)
for ( IGrinderEntry r : this.recipes )
{
if ( Platform.isSameItem( input, r.getInput() ) )
{
@ -168,21 +174,17 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return 2;
}
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
public final Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
public final Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
private void addOre( String name, ItemStack item )
{
if ( item == null )
return;
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) );
this.Ores.put( item, name );
this.ores.put( item, name );
if ( this.Dusts.containsKey( name ) )
if ( this.dusts.containsKey( name ) )
{
ItemStack is = this.Dusts.get( name ).copy();
ItemStack is = this.dusts.get( name ).copy();
int ratio = this.getDustToOreRatio( name );
if ( ratio > 1 )
{
@ -201,11 +203,11 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return;
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) );
this.Ingots.put( item, name );
this.ingots.put( item, name );
if ( this.Dusts.containsKey( name ) )
if ( this.dusts.containsKey( name ) )
{
this.addRecipe( item, this.Dusts.get( name ), 4 );
this.addRecipe( item, this.dusts.get( name ), 4 );
}
}
@ -213,7 +215,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{
if ( item == null )
return;
if ( this.Dusts.containsKey( name ) )
if ( this.dusts.containsKey( name ) )
{
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
return;
@ -221,9 +223,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
this.log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
this.Dusts.put( name, item );
this.dusts.put( name, item );
for (Entry<ItemStack, String> d : this.Ores.entrySet())
for ( Entry<ItemStack, String> d : this.ores.entrySet() )
if ( name.equals( d.getValue() ) )
{
ItemStack is = item.copy();
@ -239,7 +241,7 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
this.addRecipe( d.getKey(), is, 8 );
}
for (Entry<ItemStack, String> d : this.Ingots.entrySet())
for ( Entry<ItemStack, String> d : this.ingots.entrySet() )
if ( name.equals( d.getValue() ) )
this.addRecipe( d.getKey(), item, 4 );
}