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
@@ -140,13 +140,12 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
}
aeAmmo.setStackSize( 1 );
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).createItemStack();
if( ammo == null )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
}
ammo.setCount( 1 );
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null )
{
@@ -167,7 +166,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if( penetration <= 0 )
{
final ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
final ItemStack type = aeAmmo.asItemStackRepresentation();
if( type.getItem() instanceof ItemPaintBall )
{
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
@@ -497,7 +496,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
@Override
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.createItemStack() );
if( pen > 0 )
{
return false;