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


Java EntityPlayer.canEntityBeSeen方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:EntityEnderman.java

示例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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityEnderman.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:EntityEnderman.java

示例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;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:13,代码来源:Dig.java

示例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;
	}
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:16,代码来源:EntityEvolvedEnderman.java

示例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);
    }
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:41,代码来源:SpinToWin.java


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