Fixed tools getting deleted when being used in off-hand.
This commit is contained in:
@@ -55,12 +55,12 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
|||||||
{
|
{
|
||||||
if( p.isSneaking() )
|
if( p.isSneaking() )
|
||||||
{
|
{
|
||||||
this.encode( p.getHeldItemMainhand(), p );
|
this.encode( p.getHeldItem(hand), p );
|
||||||
p.swingArm( hand );
|
p.swingArm( hand );
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.PASS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.PASS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
|
|
||||||
if( target == null )
|
if( target == null )
|
||||||
{
|
{
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -108,17 +108,17 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
||||||
{
|
{
|
||||||
if( this.getAECurrentPower( p.getHeldItemMainhand() ) > 1600 )
|
if( this.getAECurrentPower( p.getHeldItem(hand) ) > 1600 )
|
||||||
{
|
{
|
||||||
int shots = 1;
|
int shots = 1;
|
||||||
|
|
||||||
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( p.getHeldItemMainhand() );
|
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( p.getHeldItem(hand) );
|
||||||
if( cu != null )
|
if( cu != null )
|
||||||
{
|
{
|
||||||
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
||||||
}
|
}
|
||||||
|
|
||||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItemMainhand(), null, StorageChannel.ITEMS );
|
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItem(hand), null, StorageChannel.ITEMS );
|
||||||
if( inv != null )
|
if( inv != null )
|
||||||
{
|
{
|
||||||
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||||
@@ -128,25 +128,25 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
||||||
for( int sh = 0; sh < shots; sh++ )
|
for( int sh = 0; sh < shots; sh++ )
|
||||||
{
|
{
|
||||||
this.extractAEPower( p.getHeldItemMainhand(), 1600 );
|
this.extractAEPower( p.getHeldItem(hand), 1600 );
|
||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
aeAmmo.setStackSize( 1 );
|
aeAmmo.setStackSize( 1 );
|
||||||
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||||
if( ammo == null )
|
if( ammo == null )
|
||||||
{
|
{
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ammo.setCount( 1 );
|
ammo.setCount( 1 );
|
||||||
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
||||||
if( aeAmmo == null )
|
if( aeAmmo == null )
|
||||||
{
|
{
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
|
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
|
||||||
@@ -168,7 +168,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
{
|
{
|
||||||
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
|
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
|
||||||
}
|
}
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -182,11 +182,11 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
{
|
{
|
||||||
p.sendMessage( PlayerMessages.AmmoDepleted.get() );
|
p.sendMessage( PlayerMessages.AmmoDepleted.get() );
|
||||||
}
|
}
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
|||||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
|
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||||
}
|
}
|
||||||
p.swingArm( hand );
|
p.swingArm( hand );
|
||||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItem(hand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user