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:
@@ -317,7 +317,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
|
||||
{
|
||||
ais = ais.copy();
|
||||
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
|
||||
ais.setStackSize( ais.getDefinition().getMaxStackSize() );
|
||||
while( true )
|
||||
{
|
||||
final IAEItemStack g = inv.extractItems( ais.copy(), Actionable.MODULATE, this.cluster.getActionSource() );
|
||||
@@ -329,7 +329,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
final WorldCoord wc = places.poll();
|
||||
places.add( wc );
|
||||
|
||||
Platform.spawnDrops( this.world, wc.getPos(), Collections.singletonList( g.getItemStack() ) );
|
||||
Platform.spawnDrops( this.world, wc.getPos(), Collections.singletonList( g.createItemStack() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
if( !Platform.itemComparisons().isEqualItem( is, this.myPattern ) )
|
||||
if( !ItemStack.areItemsEqual( is, this.myPattern ) )
|
||||
{
|
||||
final World w = this.getWorld();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
|
||||
@@ -140,7 +140,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return this.inv[var1].getItemStack();
|
||||
return this.inv[var1].createItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,7 +227,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
ItemStack newStack = newItemStack.copy();
|
||||
InvOperation op = InvOperation.SET;
|
||||
|
||||
if( Platform.itemComparisons().isEqualItem( oldStack, newStack ) )
|
||||
if( ItemStack.areItemsEqual( oldStack, newStack ) )
|
||||
{
|
||||
if( newStack.getCount() > oldStack.getCount() )
|
||||
{
|
||||
|
||||
@@ -122,7 +122,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
|
||||
ItemStack oldStack = this.previousStack;
|
||||
InvOperation op = InvOperation.SET;
|
||||
|
||||
if( newStack.isEmpty() || oldStack.isEmpty() || Platform.itemComparisons().isEqualItem( newStack, oldStack ) )
|
||||
if( newStack.isEmpty() || oldStack.isEmpty() || ItemStack.areItemsEqual( newStack, oldStack ) )
|
||||
{
|
||||
if( newStack.getCount() > oldStack.getCount() )
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
||||
try
|
||||
{
|
||||
final IAEItemStack item = AEItemStack.loadItemStackFromPacket( data );
|
||||
final ItemStack is = item.getItemStack();
|
||||
final ItemStack is = item.createItemStack();
|
||||
this.inv.setStackInSlot( 0, is );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
|
||||
@@ -165,7 +165,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
{
|
||||
if( ( slot & ( 1 << num ) ) > 0 )
|
||||
{
|
||||
this.inv.setStackInSlot( num, AEItemStack.loadItemStackFromPacket( data ).getItemStack() );
|
||||
this.inv.setStackInSlot( num, AEItemStack.loadItemStackFromPacket( data ).createItemStack() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
|
||||
for( final IAEItemStack ais : this.inventory.getStoredItems() )
|
||||
{
|
||||
drops.add( ais.getItemStack() );
|
||||
drops.add( ais.createItemStack() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
for( final IAEItemStack ais : this.inventory.getStoredItems() )
|
||||
{
|
||||
final NBTTagCompound it = new NBTTagCompound();
|
||||
ais.getItemStack().writeToNBT( it );
|
||||
ais.createItemStack().writeToNBT( it );
|
||||
storedItems.setTag( String.valueOf( offset ), it );
|
||||
offset++;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
||||
// read permissions
|
||||
for( final IAEItemStack ais : this.inventory.getStoredItems() )
|
||||
{
|
||||
final ItemStack is = ais.getItemStack();
|
||||
final ItemStack is = ais.createItemStack();
|
||||
final Item i = is.getItem();
|
||||
if( i instanceof IBiometricCard )
|
||||
{
|
||||
|
||||
@@ -620,7 +620,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
}
|
||||
else
|
||||
{
|
||||
this.inputInventory.setStackInSlot( 0, returns.getItemStack() );
|
||||
this.inputInventory.setStackInSlot( 0, returns.createItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user