Rework AEItemStack (#3091)

* Use itemstack as itemdef
* HIGH_TAG/LOW_TAG should be compared both directions
* Remove getTagCompound
* Make Itemlist implementation independent
* Cache item id for performance reasons
* Add preconditions to saveguard against external meddling
* Chache itemDamage
* Remove IAEStackSearchKey for now, rename getDisplayStack
This commit is contained in:
fscan
2017-09-30 17:18:30 +02:00
committed by yueh
parent 2ed7a5598a
commit 1e15b23506
75 changed files with 559 additions and 1512 deletions
@@ -50,7 +50,6 @@ public class ItemRepo
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final ArrayList<ItemStack> dsp = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
@@ -78,17 +77,6 @@ public class ItemRepo
return this.view.get( idx );
}
public ItemStack getItem( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
if( idx >= this.dsp.size() )
{
return ItemStack.EMPTY;
}
return this.dsp.get( idx );
}
void setSearch( final String search )
{
this.searchString = search == null ? "" : search;
@@ -118,10 +106,8 @@ public class ItemRepo
public void updateView()
{
this.view.clear();
this.dsp.clear();
this.view.ensureCapacity( this.list.size() );
this.dsp.ensureCapacity( this.list.size() );
final Enum viewMode = this.sortSrc.getSortDisplay();
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
@@ -235,13 +221,6 @@ public class ItemRepo
{
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME );
}
for( final IAEItemStack is : this.view )
{
final ItemStack displayStack = is.getItemStack();
displayStack.setCount( 1 );
this.dsp.add( displayStack );
}
}
private void updateJEI( String filter )