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
@@ -393,7 +393,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final double y = add.getY();
final double z = add.getZ();
final EntityItem overflowEntity = new EntityItem( w, x, y, z, overflow.getItemStack() );
final EntityItem overflowEntity = new EntityItem( w, x, y, z, overflow.createItemStack() );
overflowEntity.motionX = 0;
overflowEntity.motionY = 0;
overflowEntity.motionZ = 0;
@@ -266,9 +266,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
if( mode == Actionable.MODULATE )
{
return AEItemStack.create( d.addItems( items.getItemStack() ) );
return AEItemStack.create( d.addItems( items.createItemStack() ) );
}
return AEItemStack.create( d.simulateAdd( items.getItemStack() ) );
return AEItemStack.create( d.simulateAdd( items.createItemStack() ) );
}
}
}
@@ -304,7 +304,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
private void pushItemIntoTarget( final InventoryAdaptor d, final IEnergyGrid energy, final IMEInventory<IAEItemStack> inv, IAEItemStack ais )
{
final ItemStack is = ais.getItemStack();
final ItemStack is = ais.createItemStack();
is.setCount( (int) this.itemToSend );
final ItemStack o = d.simulateAdd( is );
@@ -320,7 +320,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
this.itemToSend -= itemsToAdd.getStackSize();
final ItemStack failed = d.addItems( itemsToAdd.getItemStack() );
final ItemStack failed = d.addItems( itemsToAdd.createItemStack() );
if( !failed.isEmpty() )
{
ais.setStackSize( failed.getCount() );
@@ -436,7 +436,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
final YesNo placeBlock = (YesNo) this.getConfigManager().getSetting( Settings.PLACE_BLOCK );
final ItemStack is = input.getItemStack();
final ItemStack is = input.createItemStack();
final Item i = is.getItem();
long maxStorage = Math.min( input.getStackSize(), is.getMaxStackSize() );
@@ -218,12 +218,12 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
{
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? ItemStack.EMPTY : whatToImport.getItemStack(), fzMode,
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? ItemStack.EMPTY : whatToImport.getDefinition(), fzMode,
this.configDestination( inv ) );
}
else
{
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? ItemStack.EMPTY : whatToImport.getItemStack(), this.configDestination( inv ) );
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? ItemStack.EMPTY : whatToImport.getDefinition(), this.configDestination( inv ) );
}
if( !newItems.isEmpty() )
@@ -245,7 +245,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( failed != null )
{
myAdaptor.addItems( failed.getItemStack() );
myAdaptor.addItems( failed.createItemStack() );
return true;
}
else
@@ -272,7 +272,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
else
{
itemStackToImport = whatToImport.getItemStack();
itemStackToImport = whatToImport.getDefinition();
}
final IAEItemStack itemAmountNotStorable;
@@ -22,7 +22,6 @@ package appeng.parts.automation;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
import appeng.util.Platform;
import appeng.util.inv.IAEAppEngInventory;
@@ -43,7 +42,7 @@ public class StackUpgradeInventory extends UpgradeInventory
for( final ItemStack is : upgrades.getSupported().keySet() )
{
if( Platform.itemComparisons().isEqualItem( this.stack, is ) )
if( ItemStack.areItemsEqual( this.stack, is ) )
{
max = upgrades.getSupported().get( is );
break;