本文整理汇总了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();
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例7: sendAttackPacket
import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
public static void sendAttackPacket(Entity entity)
{
WConnection
.sendPacket(new CPacketUseEntity(entity, EnumHand.MAIN_HAND));
}
示例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);
}
}
}
}
示例9: ICPacketUseEntity
import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
public ICPacketUseEntity(IEntity entity) {
super(new CPacketUseEntity(entity.getEntity()));
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例12: processUseEntity
import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(CPacketUseEntity p_147340_1_) {
}
示例13: processUseEntity
import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(@Nonnull CPacketUseEntity p_147340_1_) {
}
示例14: processUseEntity
import net.minecraft.network.play.client.CPacketUseEntity; //导入依赖的package包/类
@Override
public void processUseEntity(CPacketUseEntity packetIn) {
}
示例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);