Java 类net.minecraft.network.play.client.CPacketUseEntity 实例源码

项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * 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();
    }
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, EnumHand heldItem)
{
    //-ZMod-?-----------------------------------------------------
    if (!ZHandle.handle("checkReachUse", target ,true)) return EnumActionResult.FAIL;
    //------------------------------------------------------------

    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(target, heldItem));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : player.func_190775_a(target, heldItem);
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity from the entities side, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, RayTraceResult raytrace, EnumHand heldItem)
{
    this.syncCurrentPlayItem();
    Vec3d vec3d = new Vec3d(raytrace.hitVec.xCoord - target.posX, raytrace.hitVec.yCoord - target.posY, raytrace.hitVec.zCoord - target.posZ);
    this.connection.sendPacket(new CPacketUseEntity(target, heldItem, vec3d));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : target.applyPlayerInteraction(player, vec3d, heldItem);
}
项目:Backmemed    文件:PlayerControllerMP.java   
/**
   * 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();
      }
  }
项目:Backmemed    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, EnumHand heldItem)
{
    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(target, heldItem));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : player.func_190775_a(target, heldItem);
}
项目:Backmemed    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity from the entities side, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, RayTraceResult raytrace, EnumHand heldItem)
{
    this.syncCurrentPlayItem();
    Vec3d vec3d = new Vec3d(raytrace.hitVec.xCoord - target.posX, raytrace.hitVec.yCoord - target.posY, raytrace.hitVec.zCoord - target.posZ);
    this.connection.sendPacket(new CPacketUseEntity(target, heldItem, vec3d));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : target.applyPlayerInteraction(player, vec3d, heldItem);
}
项目:CustomWorldGen    文件:PlayerControllerMP.java   
/**
 * 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();
    }
}
项目:CustomWorldGen    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, @Nullable ItemStack heldItem, EnumHand hand)
{
    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(target, hand));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : player.interact(target, heldItem, hand);
}
项目:CustomWorldGen    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity from the entities side, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, RayTraceResult raytrace, @Nullable ItemStack heldItem, EnumHand hand)
{
    this.syncCurrentPlayItem();
    Vec3d vec3d = new Vec3d(raytrace.hitVec.xCoord - target.posX, raytrace.hitVec.yCoord - target.posY, raytrace.hitVec.zCoord - target.posZ);
    this.connection.sendPacket(new CPacketUseEntity(target, hand, vec3d));
    if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(player, target, raytrace, player.getHeldItem(hand), hand)) return EnumActionResult.PASS;
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : target.applyPlayerInteraction(player, vec3d, heldItem, hand);
}
项目:ExpandedRailsMod    文件:PlayerControllerMP.java   
/**
 * 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();
    }
}
项目:ExpandedRailsMod    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, @Nullable ItemStack heldItem, EnumHand hand)
{
    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketUseEntity(target, hand));
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : player.interact(target, heldItem, hand);
}
项目:ExpandedRailsMod    文件:PlayerControllerMP.java   
/**
 * Handles right clicking an entity from the entities side, sends a packet to the server.
 */
public EnumActionResult interactWithEntity(EntityPlayer player, Entity target, RayTraceResult raytrace, @Nullable ItemStack heldItem, EnumHand hand)
{
    this.syncCurrentPlayItem();
    Vec3d vec3d = new Vec3d(raytrace.hitVec.xCoord - target.posX, raytrace.hitVec.yCoord - target.posY, raytrace.hitVec.zCoord - target.posZ);
    this.connection.sendPacket(new CPacketUseEntity(target, hand, vec3d));
    if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(player, target, raytrace, player.getHeldItem(hand), hand)) return EnumActionResult.PASS;
    return this.currentGameType == GameType.SPECTATOR ? EnumActionResult.PASS : target.applyPlayerInteraction(player, vec3d, heldItem, hand);
}
项目:Wurst-MC-1.12-OF    文件:WPlayer.java   
public static void sendAttackPacket(Entity entity)
{
    WConnection
        .sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
项目:Wurst-MC-1.12    文件:WPlayer.java   
public static void sendAttackPacket(Entity entity)
{
    WConnection
        .sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
项目:Zombe-Modpack    文件:NetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
public void processUseEntity(CPacketUseEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    Entity entity = packetIn.getEntityFromWorld(worldserver);
    this.playerEntity.markPlayerActive();

    if (entity != null)
    {
        boolean flag = this.playerEntity.canEntityBeSeen(entity);
        //-ZMod-Dig-reach-----------------------------------------------------
        // double d0 = 36.0D;
        double d0 = ZHandle.handle("getPlayerReachUseSq", 36.0D);
        //--------------------------------------------------------------------

        if (!flag)
        {
            d0 = 9.0D;
        }

        if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
        {
            if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT)
            {
                EnumHand enumhand = packetIn.getHand();
                this.playerEntity.func_190775_a(entity, enumhand);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT_AT)
            {
                EnumHand enumhand1 = packetIn.getHand();
                entity.applyPlayerInteraction(this.playerEntity, packetIn.getHitVec(), enumhand1);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.ATTACK)
            {
                if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity)
                {
                    this.kickPlayerFromServer("Attempting to attack an invalid entity");
                    this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity");
                    return;
                }

                this.playerEntity.attackTargetEntityWithCurrentItem(entity);
            }
        }
    }
}
项目:EMC    文件:ICPacketUseEntity.java   
public ICPacketUseEntity(IEntity entity) {
    super(new CPacketUseEntity(entity.getEntity()));
}
项目:Backmemed    文件:NetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
public void processUseEntity(CPacketUseEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    Entity entity = packetIn.getEntityFromWorld(worldserver);
    this.playerEntity.markPlayerActive();

    if (entity != null)
    {
        boolean flag = this.playerEntity.canEntityBeSeen(entity);
        double d0 = 36.0D;

        if (!flag)
        {
            d0 = 9.0D;
        }

        if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
        {
            if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT)
            {
                EnumHand enumhand = packetIn.getHand();
                this.playerEntity.func_190775_a(entity, enumhand);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT_AT)
            {
                EnumHand enumhand1 = packetIn.getHand();
                entity.applyPlayerInteraction(this.playerEntity, packetIn.getHitVec(), enumhand1);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.ATTACK)
            {
                if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity)
                {
                    this.kickPlayerFromServer("Attempting to attack an invalid entity");
                    this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity");
                    return;
                }

                this.playerEntity.attackTargetEntityWithCurrentItem(entity);
            }
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
public void processUseEntity(CPacketUseEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    Entity entity = packetIn.getEntityFromWorld(worldserver);
    this.playerEntity.markPlayerActive();

    if (entity != null)
    {
        boolean flag = this.playerEntity.canEntityBeSeen(entity);
        double d0 = 36.0D;

        if (!flag)
        {
            d0 = 9.0D;
        }

        if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
        {
            if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT)
            {
                EnumHand enumhand = packetIn.getHand();
                ItemStack itemstack = this.playerEntity.getHeldItem(enumhand);
                this.playerEntity.interact(entity, itemstack, enumhand);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT_AT)
            {
                EnumHand enumhand1 = packetIn.getHand();
                ItemStack itemstack1 = this.playerEntity.getHeldItem(enumhand1);
                if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(playerEntity, entity, packetIn.getHitVec(), itemstack1, enumhand1)) return;
                entity.applyPlayerInteraction(this.playerEntity, packetIn.getHitVec(), itemstack1, enumhand1);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.ATTACK)
            {
                if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity)
                {
                    this.kickPlayerFromServer("Attempting to attack an invalid entity");
                    this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity");
                    return;
                }

                this.playerEntity.attackTargetEntityWithCurrentItem(entity);
            }
        }
    }
}
项目:Wurst-MC-1.11    文件:WPlayer.java   
public static void sendAttackPacket(Entity entity)
{
    WConnection
        .sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
@Override
public void processUseEntity(CPacketUseEntity p_147340_1_) {
}
项目:Wurst-MC-1.10    文件:WPlayer.java   
public static void sendAttackPacket(Entity entity)
{
    WConnection
        .sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
项目:Wurst-MC-1.9    文件:WPlayer.java   
public static void sendAttackPacket(Entity entity)
{
    WConnection
        .sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
项目:ExpandedRailsMod    文件:NetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
public void processUseEntity(CPacketUseEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    Entity entity = packetIn.getEntityFromWorld(worldserver);
    this.playerEntity.markPlayerActive();

    if (entity != null)
    {
        boolean flag = this.playerEntity.canEntityBeSeen(entity);
        double d0 = 36.0D;

        if (!flag)
        {
            d0 = 9.0D;
        }

        if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
        {
            if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT)
            {
                EnumHand enumhand = packetIn.getHand();
                ItemStack itemstack = this.playerEntity.getHeldItem(enumhand);
                this.playerEntity.interact(entity, itemstack, enumhand);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.INTERACT_AT)
            {
                EnumHand enumhand1 = packetIn.getHand();
                ItemStack itemstack1 = this.playerEntity.getHeldItem(enumhand1);
                if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(playerEntity, entity, packetIn.getHitVec(), itemstack1, enumhand1)) return;
                entity.applyPlayerInteraction(this.playerEntity, packetIn.getHitVec(), itemstack1, enumhand1);
            }
            else if (packetIn.getAction() == CPacketUseEntity.Action.ATTACK)
            {
                if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity)
                {
                    this.kickPlayerFromServer("Attempting to attack an invalid entity");
                    this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity");
                    return;
                }

                this.playerEntity.attackTargetEntityWithCurrentItem(entity);
            }
        }
    }
}
项目:EnderIO    文件:FakeNetHandlerPlayServer.java   
@Override
public void processUseEntity(@Nonnull CPacketUseEntity p_147340_1_) {
}
项目:DankNull    文件:NetServerHandlerFake.java   
@Override
public void processUseEntity(CPacketUseEntity packetIn) {

}
项目:Backmemed    文件:INetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
void processUseEntity(CPacketUseEntity packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayServer.java   
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
void processUseEntity(CPacketUseEntity packetIn);