Fixed Right Click Behavior of BiometricCard and Network tool when clicking on air.
This commit is contained in:
@@ -37,26 +37,28 @@ public class ToolBiometricCard extends AEBaseItem
|
|||||||
@Override
|
@Override
|
||||||
public boolean itemInteractionForEntity(ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target)
|
public boolean itemInteractionForEntity(ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target)
|
||||||
{
|
{
|
||||||
if ( target instanceof EntityPlayer )
|
if ( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
|
||||||
{
|
{
|
||||||
if ( par2EntityPlayer.capabilities.isCreativeMode )
|
if ( par2EntityPlayer.capabilities.isCreativeMode )
|
||||||
is = par2EntityPlayer.getCurrentEquippedItem();
|
is = par2EntityPlayer.getCurrentEquippedItem();
|
||||||
encode( is, (EntityPlayer) target );
|
encode( is, (EntityPlayer) target );
|
||||||
|
par2EntityPlayer.swingItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitx, float hity, float hitz)
|
public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer p)
|
||||||
{
|
{
|
||||||
if ( p.isSneaking() )
|
if ( p.isSneaking() )
|
||||||
{
|
{
|
||||||
encode( is, p );
|
encode( is, p );
|
||||||
return true;
|
p.swingItem();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encode(ItemStack is, EntityPlayer p)
|
private void encode(ItemStack is, EntityPlayer p)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import appeng.api.implementations.guiobjects.IGuiItem;
|
|||||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||||
import appeng.api.implementations.items.IAEWrench;
|
import appeng.api.implementations.items.IAEWrench;
|
||||||
import appeng.api.networking.IGridHost;
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.items.AEBaseItem;
|
import appeng.items.AEBaseItem;
|
||||||
@@ -64,16 +65,27 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
|||||||
|
|
||||||
if ( !p.isSneaking() )
|
if ( !p.isSneaking() )
|
||||||
{
|
{
|
||||||
|
if ( p.openContainer instanceof AEBaseContainer )
|
||||||
|
return true;
|
||||||
|
|
||||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||||
if ( te instanceof IGridHost )
|
if ( te instanceof IGridHost )
|
||||||
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
|
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
|
||||||
else
|
else
|
||||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
|
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||||
|
{
|
||||||
|
onItemUse( par1ItemStack, par3EntityPlayer, par2World, 0, 0, 0, -1, 0, 0, 0 );
|
||||||
|
return super.onItemRightClick( par1ItemStack, par2World, par3EntityPlayer );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user