Compare commits

...

4 Commits

Author SHA1 Message Date
thatsIch 4744dfab78 Merge pull request #1029 from thatsIch/e-1024-zinc
Fixes #1024 Added zinc to the grindstone, which is part of Flaxbeards Steam Power (FSP)
2015-03-15 18:38:03 +01:00
thatsIch 7dedd4700f Fixes #1024 Added zinc to the grindstone, which is part of Flaxbeards Steam Power (FSP)
Added zinc to the array of checked ore dictionary names, so if any mod decides to add Zinc in the future or uses it via the OreDictionary, it will be automatically added to the grindstone.

The commit also contains some scoping and code cleanup of the underlaying calls
2015-03-15 09:02:23 +01:00
thatsIch 95fb894ba3 Merge pull request #1028 from bakaxyf/patch-1
Update zh_CN.lang
2015-03-15 08:22:05 +01:00
bakaxyf 621ddc5535 Update zh_CN.lang 2015-03-15 11:05:24 +08:00
3 changed files with 66 additions and 57 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
// AE // AE
"CertusQuartz", "Wheat", "Fluix", "CertusQuartz", "Wheat", "Fluix",
// Other Mod Ores // Other Mod Ores
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" }; "Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium", "Zinc" };
public double oreDoublePercentage = 90.0; public double oreDoublePercentage = 90.0;
@@ -18,6 +18,7 @@
package appeng.core.features.registries; package appeng.core.features.registries;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -37,20 +38,20 @@ import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler; import appeng.recipes.ores.OreDictionaryHandler;
import appeng.util.Platform; 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; public GrinderRecipeManager()
private ItemStack copy(ItemStack is)
{ {
if ( is != null ) this.recipes = new ArrayList<IGrinderEntry>();
return is.copy(); this.ores = new HashMap<ItemStack, String>();
return null; this.ingots = new HashMap<ItemStack, String>();
} this.dusts = new HashMap<String, ItemStack>();
public GrinderRecipeManager() {
this.RecipeList = new ArrayList<IGrinderEntry>();
this.addOre( "Coal", new ItemStack( Items.coal ) ); this.addOre( "Coal", new ItemStack( Items.coal ) );
this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) ); this.addOre( "Charcoal", new ItemStack( Items.coal, 1, 1 ) );
@@ -78,20 +79,11 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
public List<IGrinderEntry> getRecipes() public List<IGrinderEntry> getRecipes()
{ {
this.log( "API - getRecipes" ); this.log( "API - getRecipes" );
return this.RecipeList; return this.recipes;
}
private void injectRecipe(AppEngGrinderRecipe appEngGrinderRecipe)
{
for (IGrinderEntry gr : this.RecipeList)
if ( Platform.isSameItemPrecise( gr.getInput(), appEngGrinderRecipe.getInput() ) )
return;
this.RecipeList.add( appEngGrinderRecipe );
} }
@Override @Override
public void addRecipe(ItemStack in, ItemStack out, int cost) public void addRecipe( ItemStack in, ItemStack out, int cost )
{ {
if ( in == null || out == null ) if ( in == null || out == null )
{ {
@@ -104,40 +96,54 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
} }
@Override @Override
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int cost) public void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, int cost )
{ {
if ( in == null || (optional == null && out == null) ) if ( in == null || ( optional == null && out == null ) )
{ {
this.log( "Invalid Grinder Recipe Specified." ); this.log( "Invalid Grinder Recipe Specified." );
return; return;
} }
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) ); this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
} }
@Override @Override
public void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int cost) 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) ) if ( in == null || ( optional == null && out == null && optional2 == null ) )
{ {
this.log( "Invalid Grinder Recipe Specified." ); this.log( "Invalid Grinder Recipe Specified." );
return; return;
} }
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
+ Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, 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 @Override
public IGrinderEntry getRecipeForInput(ItemStack input) public IGrinderEntry getRecipeForInput( ItemStack input )
{ {
this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) ); this.log( "Looking up recipe for " + Platform.getItemDisplayName( input ) );
if ( input != null ) if ( input != null )
{ {
for (IGrinderEntry r : this.RecipeList) for ( IGrinderEntry r : this.recipes )
{ {
if ( Platform.isSameItem( input, r.getInput() ) ) if ( Platform.isSameItem( input, r.getInput() ) )
{ {
@@ -152,12 +158,12 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return null; return null;
} }
public void log(String o) public void log( String o )
{ {
AELog.grinder( o ); AELog.grinder( o );
} }
private int getDustToOreRatio(String name) private int getDustToOreRatio( String name )
{ {
if ( name.equals( "Obsidian" ) ) if ( name.equals( "Obsidian" ) )
return 1; return 1;
@@ -168,52 +174,48 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return 2; return 2;
} }
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>(); private void addOre( String name, ItemStack item )
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 ) if ( item == null )
return; return;
this.log( "Adding Ore - " + name + " : " + Platform.getItemDisplayName( item ) ); 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 ); int ratio = this.getDustToOreRatio( name );
if ( ratio > 1 ) if ( ratio > 1 )
{ {
ItemStack extra = is.copy(); ItemStack extra = is.copy();
extra.stackSize = ratio - 1; extra.stackSize = ratio - 1;
this.addRecipe( item, is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 ); this.addRecipe( item, is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
} }
else else
this.addRecipe( item, is, 8 ); this.addRecipe( item, is, 8 );
} }
} }
private void addIngot(String name, ItemStack item) private void addIngot( String name, ItemStack item )
{ {
if ( item == null ) if ( item == null )
return; return;
this.log( "Adding Ingot - " + name + " : " + Platform.getItemDisplayName( item ) ); 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 );
} }
} }
private void addDust(String name, ItemStack item) private void addDust( String name, ItemStack item )
{ {
if ( item == null ) if ( item == null )
return; return;
if ( this.Dusts.containsKey( name ) ) if ( this.dusts.containsKey( name ) )
{ {
this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) ); this.log( "Rejecting Dust - " + name + " : " + Platform.getItemDisplayName( item ) );
return; return;
@@ -221,9 +223,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
this.log( "Adding Dust - " + name + " : " + Platform.getItemDisplayName( item ) ); 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() ) ) if ( name.equals( d.getValue() ) )
{ {
ItemStack is = item.copy(); ItemStack is = item.copy();
@@ -233,23 +235,23 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{ {
ItemStack extra = is.copy(); ItemStack extra = is.copy();
extra.stackSize = ratio - 1; extra.stackSize = ratio - 1;
this.addRecipe( d.getKey(), is, extra, (float) (AEConfig.instance.oreDoublePercentage / 100.0), 8 ); this.addRecipe( d.getKey(), is, extra, (float) ( AEConfig.instance.oreDoublePercentage / 100.0 ), 8 );
} }
else else
this.addRecipe( d.getKey(), is, 8 ); 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() ) ) if ( name.equals( d.getValue() ) )
this.addRecipe( d.getKey(), item, 4 ); this.addRecipe( d.getKey(), item, 4 );
} }
@Override @Override
public void oreRegistered(String name, ItemStack item) public void oreRegistered( String name, ItemStack item )
{ {
if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) ) if ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name.startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) )
{ {
for (String ore : AEConfig.instance.grinderOres) for ( String ore : AEConfig.instance.grinderOres )
{ {
if ( name.equals( "ore" + ore ) ) if ( name.equals( "ore" + ore ) )
{ {
@@ -66,6 +66,9 @@ chat.appliedenergistics2.OutOfRange=超出无线信号范围.
chat.appliedenergistics2.InvalidMachine=无效机器. chat.appliedenergistics2.InvalidMachine=无效机器.
chat.appliedenergistics2.LoadedSettings=成功载入设定. chat.appliedenergistics2.LoadedSettings=成功载入设定.
chat.appliedenergistics2.DeviceNotPowered=设备供能不足. chat.appliedenergistics2.DeviceNotPowered=设备供能不足.
chat.appliedenergistics2.DeviceNotWirelessTerminal=设备不是无线终端.
chat.appliedenergistics2.DeviceNotLinked=设备未连接.
chat.appliedenergistics2.StationCanNotBeLocated=无法定位安全终端.
chat.appliedenergistics2.MachineNotPowered=机器未供能. chat.appliedenergistics2.MachineNotPowered=机器未供能.
chat.appliedenergistics2.CommunicationError=网络交互错误. chat.appliedenergistics2.CommunicationError=网络交互错误.
chat.appliedenergistics2.SavedSettings=成功保存设定. chat.appliedenergistics2.SavedSettings=成功保存设定.
@@ -194,7 +197,7 @@ gui.appliedenergistics2.NoCraftingCPUs=没有可用的合成CPU...
gui.appliedenergistics2.CalculatingWait=正在计算,请等待... gui.appliedenergistics2.CalculatingWait=正在计算,请等待...
gui.appliedenergistics2.Clean=清空 gui.appliedenergistics2.Clean=清空
gui.appliedenergistics2.InvalidPattern=无效样板 gui.appliedenergistics2.InvalidPattern=无效样板
gui.appliedenergistics2.Range=Range gui.appliedenergistics2.Range=范围
gui.appliedenergistics2.TransparentFacades=透明的伪装板 gui.appliedenergistics2.TransparentFacades=透明的伪装板
gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度. gui.appliedenergistics2.TransparentFacadesHint=控制当网络工具放在快捷栏时,伪装板显示的透明度.
gui.appliedenergistics2.CPUs=CPU gui.appliedenergistics2.CPUs=CPU
@@ -288,6 +291,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=在物品合成时发射红石
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品 gui.tooltips.appliedenergistics2.ReportInaccessibleItems=报告不可交互的物品
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品. gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=是: 显示无法取出的物品.
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品. gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=否: 只显示可以取出的物品.
gui.tooltips.appliedenergistics2.BlockPlacement=方块放置方式
gui.tooltips.appliedenergistics2.BlockPlacementYes=方块将被放置.
gui.tooltips.appliedenergistics2.BlockPlacementNo=方块将以物品形式掉落.
gui.appliedenergistics2.units.appliedenergstics=AE gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.buildcraft=MJ gui.appliedenergistics2.units.buildcraft=MJ
@@ -322,6 +328,7 @@ waila.appliedenergistics2.Unlocked=未锁定
waila.appliedenergistics2.Showing=显示 waila.appliedenergistics2.Showing=显示
waila.appliedenergistics2.Contains=容纳 waila.appliedenergistics2.Contains=容纳
waila.appliedenergistics2.Channels=频道 waila.appliedenergistics2.Channels=频道
waila.appliedenergistics2.Crafting=合成中
item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件 item.appliedenergistics2.ItemBasicStorageCell.1k.name=1k-ME存储元件
item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件 item.appliedenergistics2.ItemBasicStorageCell.4k.name=4k-ME存储元件