Fixed a crash when dealing with large ore dictionary registrations.
This commit is contained in:
parent
feb7d7be95
commit
f3a9a12e04
3 changed files with 22 additions and 18 deletions
|
@ -207,16 +207,16 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
|
|||
if ( ais.isOre() )
|
||||
{
|
||||
OreRefrence or = ais.def.isOre;
|
||||
if ( or.aeotherOptions.size() == 1 )
|
||||
if ( or.getAEEquivilients().size() == 1 )
|
||||
{
|
||||
IAEItemStack is = or.aeotherOptions.get( 0 );
|
||||
IAEItemStack is = or.getAEEquivilients().get( 0 );
|
||||
return findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
Collection<StackType> output = new LinkedList();
|
||||
|
||||
for (IAEItemStack is : or.aeotherOptions)
|
||||
for (IAEItemStack is : or.getAEEquivilients())
|
||||
output.addAll( findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) );
|
||||
|
||||
return output;
|
||||
|
|
|
@ -68,7 +68,6 @@ public class OreHelper
|
|||
OreRefrence ref = new OreRefrence();
|
||||
Collection<Integer> ores = ref.getOres();
|
||||
Collection<ItemStack> set = ref.getEquivilients();
|
||||
Collection<IAEItemStack> aeset = ref.getAEEquivilients();
|
||||
|
||||
for (String ore : OreDictionary.getOreNames())
|
||||
{
|
||||
|
@ -93,14 +92,7 @@ public class OreHelper
|
|||
}
|
||||
|
||||
if ( !set.isEmpty() )
|
||||
{
|
||||
or.oreValue = ref;
|
||||
|
||||
// SUMMON AE STACKS!
|
||||
for (ItemStack is : set)
|
||||
if ( is.getItem() != null )
|
||||
aeset.add( AEItemStack.create( is ) );
|
||||
}
|
||||
}
|
||||
|
||||
return or.oreValue;
|
||||
|
@ -118,7 +110,7 @@ public class OreHelper
|
|||
return false;
|
||||
|
||||
Collection<Integer> bOres = b.getOres();
|
||||
for (Integer ore : a.ores)
|
||||
for (Integer ore : a.getOres())
|
||||
{
|
||||
if ( bOres.contains( ore ) )
|
||||
return true;
|
||||
|
@ -134,9 +126,9 @@ public class OreHelper
|
|||
|
||||
if ( a == b )
|
||||
return true;
|
||||
|
||||
|
||||
Collection<Integer> bOres = b.getOres();
|
||||
for (Integer ore : a.ores)
|
||||
for (Integer ore : a.getOres())
|
||||
{
|
||||
if ( bOres.contains( ore ) )
|
||||
return true;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package appeng.util.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
@ -10,17 +12,27 @@ import appeng.api.storage.data.IAEItemStack;
|
|||
public class OreRefrence
|
||||
{
|
||||
|
||||
LinkedList<ItemStack> otherOptions = new LinkedList();
|
||||
LinkedList<IAEItemStack> aeotherOptions = new LinkedList();
|
||||
HashSet<Integer> ores = new HashSet<Integer>();
|
||||
private LinkedList<ItemStack> otherOptions = new LinkedList();
|
||||
private ArrayList aeotherOptions = null;
|
||||
private HashSet<Integer> ores = new HashSet<Integer>();
|
||||
|
||||
public Collection<ItemStack> getEquivilients()
|
||||
{
|
||||
return otherOptions;
|
||||
}
|
||||
|
||||
public Collection<IAEItemStack> getAEEquivilients()
|
||||
public List<IAEItemStack> getAEEquivilients()
|
||||
{
|
||||
if ( aeotherOptions == null )
|
||||
{
|
||||
aeotherOptions = new ArrayList( otherOptions.size() );
|
||||
|
||||
// SUMMON AE STACKS!
|
||||
for (ItemStack is : otherOptions)
|
||||
if ( is.getItem() != null )
|
||||
aeotherOptions.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
return aeotherOptions;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue