当前位置: 首页>>代码示例>>Java>>正文


Java CPacketUseEntity类代码示例

本文整理汇总了Java中net.minecraft.network.play.client.CPacketUseEntity的典型用法代码示例。如果您正苦于以下问题:Java CPacketUseEntity类的具体用法?Java CPacketUseEntity怎么用?Java CPacketUseEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CPacketUseEntity类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketUseEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attackEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:21,代码来源:PlayerControllerMP.java

示例2: interactWithEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:14,代码来源:PlayerControllerMP.java

示例3: attackEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
   * 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();
      }
  }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:PlayerControllerMP.java

示例4: interactWithEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:PlayerControllerMP.java

示例5: attackEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:PlayerControllerMP.java

示例6: interactWithEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:PlayerControllerMP.java

示例7: sendAttackPacket

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
public static void sendAttackPacket(Entity entity)
{
	WConnection
		.sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12-OF,代码行数:6,代码来源:WPlayer.java

示例8: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
            }
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:51,代码来源:NetHandlerPlayServer.java

示例9: ICPacketUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
public ICPacketUseEntity(IEntity entity) {
	super(new CPacketUseEntity(entity.getEntity()));
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:4,代码来源:ICPacketUseEntity.java

示例10: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:48,代码来源:NetHandlerPlayServer.java

示例11: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * 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);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:NetHandlerPlayServer.java

示例12: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(CPacketUseEntity p_147340_1_) {
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:FakeNetHandlerPlayServer.java

示例13: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(@Nonnull CPacketUseEntity p_147340_1_) {
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:4,代码来源:FakeNetHandlerPlayServer.java

示例14: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(CPacketUseEntity packetIn) {

}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:5,代码来源:NetServerHandlerFake.java

示例15: processUseEntity

import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
/**
 * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently
 * equipped item
 */
void processUseEntity(CPacketUseEntity packetIn);
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:INetHandlerPlayServer.java


注:本文中的net.minecraft.network.play.client.CPacketUseEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。