本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.canEntityBeSeen方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.canEntityBeSeen方法的具体用法?Java EntityPlayer.canEntityBeSeen怎么用?Java EntityPlayer.canEntityBeSeen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.canEntityBeSeen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAttackPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Checks to see if this enderman should be attacking this player
*/
private boolean shouldAttackPlayer(EntityPlayer player)
{
ItemStack itemstack = player.inventory.armorInventory[3];
if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
{
return false;
}
else
{
Vec3 vec3 = player.getLook(1.0F).normalize();
Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
double d0 = vec31.lengthVector();
vec31 = vec31.normalize();
double d1 = vec3.dotProduct(vec31);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
示例2: shouldAttackPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Checks to see if this enderman should be attacking this player
*/
private boolean shouldAttackPlayer(EntityPlayer player)
{
ItemStack itemstack = (ItemStack)player.inventory.armorInventory.get(3);
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
{
return false;
}
else
{
Vec3d vec3d = player.getLook(1.0F).normalize();
Vec3d vec3d1 = new Vec3d(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)this.getEyeHeight() - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
double d0 = vec3d1.lengthVector();
vec3d1 = vec3d1.normalize();
double d1 = vec3d.dotProduct(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
示例3: shouldAttackPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Checks to see if this enderman should be attacking this player
*/
private boolean shouldAttackPlayer(EntityPlayer player)
{
ItemStack itemstack = player.inventory.armorInventory[3];
if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
{
return false;
}
else
{
Vec3d vec3d = player.getLook(1.0F).normalize();
Vec3d vec3d1 = new Vec3d(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)this.getEyeHeight() - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
double d0 = vec3d1.lengthVector();
vec3d1 = vec3d1.normalize();
double d1 = vec3d.dotProduct(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
示例4: checkReachUse
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private static boolean checkReachUse(Entity ent) {
if (!optCheckReach) return true;
EntityPlayer player = getPlayer();
if (player == null || ent == null || player == ent) return false;
boolean seen = player.canEntityBeSeen(ent);
float reach = seen ? getReachUseSq(36) : 9f;
double dx = player.posX - ent.posX;
double dy = player.posY - ent.posY;
double dz = player.posZ - ent.posZ;
double dist = dx*dx + dy*dy + dz*dz;
return dist < reach;
}
示例5: shouldAttackPlayer
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private boolean shouldAttackPlayer(EntityPlayer player) {
ItemStack itemstack = player.inventory.armorInventory.get(3);
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN) || itemstack.getItem() instanceof ItemSkullBase) {
return false;
}
else {
Vec3d vec3d = player.getLook(1.0F).normalize();
Vec3d vec3d1 = new Vec3d(posX - player.posX, getEntityBoundingBox().minY + getEyeHeight() - (player.posY + player.getEyeHeight()), posZ - player.posZ);
double d0 = vec3d1.lengthVector();
vec3d1 = vec3d1.normalize();
double d1 = vec3d.dotProduct(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
示例6: isSuitableTarget
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static boolean isSuitableTarget(EntityPlayer attacker, @Nullable EntityLivingBase target, boolean includeInvincibles, boolean checkSight)
{
if (target == null)
{
return false;
}
else if (target == attacker)
{
return false;
}
else if (!target.isEntityAlive())
{
return false;
}
else if (target instanceof EntityPlayer && !attacker.canAttackPlayer((EntityPlayer) target))
{
return false;
}
else
{
if (attacker instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId() != null)
{
if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(target.getUniqueID()))
{
return false;
}
if (target == ((IEntityOwnable)attacker).getOwner())
{
return false;
}
}
else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage)
{
return false;
}
return !checkSight || attacker.canEntityBeSeen(target);
}
}