當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。