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


Java Entity.isInWater方法代码示例

本文整理汇总了Java中net.minecraft.entity.Entity.isInWater方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.isInWater方法的具体用法?Java Entity.isInWater怎么用?Java Entity.isInWater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.isInWater方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPathPointTo

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Returns given entity's position as PathPoint
 */
public PathPoint getPathPointTo(Entity entityIn)
{
    int i;

    if (this.canSwim && entityIn.isInWater())
    {
        i = (int)entityIn.getEntityBoundingBox().minY;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));

        for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
        {
            ++i;
            blockpos$mutableblockpos.func_181079_c(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
        }

        this.avoidsWater = false;
    }
    else
    {
        i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D);
    }

    return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:WalkNodeProcessor.java

示例2: calculateCritPost

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static int calculateCritPost(Entity target, EntityLivingBase shooter, int initial, ItemStack stack) {
	if (initial > 0 && (target instanceof EntityLivingBase && ((EntityLivingBase) target).getActivePotionEffect(TF2weapons.backup) != null))
		initial = 0;
	if (initial == 0 && (target instanceof EntityLivingBase && (((EntityLivingBase) target).getActivePotionEffect(TF2weapons.markDeath) != null
			|| ((EntityLivingBase) target).getActivePotionEffect(TF2weapons.jarate) != null)))
		initial = 1;
	if (initial == 0 && !stack.isEmpty() && !target.onGround && !target.isInWater() && TF2Attribute.getModifier("Minicrit Airborne", stack, 0, shooter) != 0)
		initial = 1;
	if (initial == 0 && !stack.isEmpty() && shooter != null) {
		float mindist=TF2Attribute.getModifier("Minicrit Distance", stack, 0, shooter);
		mindist*=mindist;
		if(mindist != 0f && target.getDistanceSqToEntity(shooter) >= mindist)
			initial = 1;
	}
	if (initial < 2 && (!stack.isEmpty() && target.isBurning() && TF2Attribute.getModifier("Crit Burn", stack, 0, shooter) != 0))
		initial = 2;
	if (initial < 2 && (!stack.isEmpty() && (target instanceof EntityLivingBase && ((EntityLivingBase) target).getActivePotionEffect(TF2weapons.stun) != null))
			&& TF2Attribute.getModifier("Crit Stun", stack, 0, shooter) != 0)
		initial = 2;
	if (initial < 2 && (!stack.isEmpty() && shooter != null && shooter instanceof EntityPlayer && 
			(shooter.getCapability(TF2weapons.WEAPONS_CAP, null).isExpJump() || shooter.isElytraFlying())
			&& TF2Attribute.getModifier("Crit Rocket", stack, 0, shooter) != 0))
		initial = 2;
	if (initial == 1 && (!stack.isEmpty() && shooter != null && shooter instanceof EntityPlayer && TF2Attribute.getModifier("Crit Mini", stack, 0, shooter) != 0))
		initial = 2;
	if (target instanceof EntityTF2Boss && initial == 1)
		initial = 0;
	if (target instanceof EntityMerasmus && ((EntityMerasmus) target).getActivePotionEffect(TF2weapons.stun) != null)
		initial = 2;
	return initial;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:32,代码来源:TF2Util.java


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