Java Code Examples for net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem()

The following are Jave code examples for showing how to use attackTargetEntityWithCurrentItem() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Zombe-Modpack   File: PlayerControllerMP.java   View Source Code Vote up 6 votes
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    //-ZMod-Ghost-fix
    if (playerIn == targetEntity) return;
    //-ZMod-?
    if (!ZHandle.handle("checkReachUse", targetEntity, true)) return;
    //------------------------------------------------------------

    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(targetEntity));

    if (this.currentGameType != GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
        playerIn.resetCooldown();
    }
}
 
Example 2
Project: DecompiledMinecraft   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));

    if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
 
Example 3
Project: BaseClient   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));

    if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
 
Example 4
Project: BaseClient   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK));

    if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
    }
}
 
Example 5
Project: Backmemed   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
/**
   * Attacks an entity
   */
  public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
  {
if(Hacks.findMod(Criticals.class).isEnabled())
	Criticals.doCrit();

      this.syncCurrentPlayItem();
      this.connection.sendPacket(new CPacketUseEntity(targetEntity));

      if (this.currentGameType != GameType.SPECTATOR)
      {
          playerIn.attackTargetEntityWithCurrentItem(targetEntity);
          playerIn.resetCooldown();
      }
  }
 
Example 6
Project: CustomWorldGen   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
/**
 * Attacks an entity
 */
public void attackEntity(EntityPlayer playerIn, Entity targetEntity)
{
    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(targetEntity));

    if (this.currentGameType != GameType.SPECTATOR)
    {
        playerIn.attackTargetEntityWithCurrentItem(targetEntity);
        playerIn.resetCooldown();
    }
}
 
Example 7
Project: harshencastle   File: MessagePacketHitWithRange.java   View Source Code Vote up 4 votes
@Override
public void onReceived(MessagePacketHitWithRange message, EntityPlayer player)
{
       player.attackTargetEntityWithCurrentItem(player.world.getEntityByID(message.entityId));
   }