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


Java BlockLiquid.getLiquidHeightPercent方法代码示例

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


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

示例1: isInsideOfMaterial

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
/**
 * Checks if the current block the entity is within of the specified material type
 */
public boolean isInsideOfMaterial(Material materialIn)
{
    double d0 = this.posY + (double)this.getEyeHeight();
    BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
    IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block.getMaterial() == materialIn)
    {
        float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F;
        float f1 = (float)(blockpos.getY() + 1) - f;
        boolean flag = d0 < (double)f1;
        return !flag && this instanceof EntityPlayer ? false : flag;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:Entity.java

示例2: getBlockAtEntityViewpoint

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
public static Block getBlockAtEntityViewpoint(World worldIn, Entity p_180786_1_, float p_180786_2_)
{
    Vec3 vec3 = projectViewFromEntity(p_180786_1_, (double)p_180786_2_);
    BlockPos blockpos = new BlockPos(vec3);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block.getMaterial().isLiquid())
    {
        float f = 0.0F;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            f = BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F;
        }

        float f1 = (float)(blockpos.getY() + 1) - f;

        if (vec3.yCoord >= (double)f1)
        {
            block = worldIn.getBlockState(blockpos.up()).getBlock();
        }
    }

    return block;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ActiveRenderInfo.java

示例3: isInsideOfMaterial

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
/**
 * Checks if the current block the entity is within of the specified material type
 */
public boolean isInsideOfMaterial(Material materialIn)
{
    if (this.getRidingEntity() instanceof EntityBoat)
    {
        return false;
    }
    else
    {
        double d0 = this.posY + (double)this.getEyeHeight();
        BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
        IBlockState iblockstate = this.world.getBlockState(blockpos);

        if (iblockstate.getMaterial() == materialIn)
        {
            float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F;
            float f1 = (float)(blockpos.getY() + 1) - f;
            boolean flag = d0 < (double)f1;
            return !flag && this instanceof EntityPlayer ? false : flag;
        }
        else
        {
            return false;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:Entity.java

示例4: isInsideOfMaterial

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos)
{
    IBlockState state = entity.worldObj.getBlockState(pos);
    Block block = state.getBlock();
    double eyes = entity.posY + (double)entity.getEyeHeight();

    double filled = 1.0f; //If it's not a liquid assume it's a solid block
    if (block instanceof IFluidBlock)
    {
        filled = ((IFluidBlock)block).getFilledPercentage(entity.worldObj, pos);
    }
    else if (block instanceof BlockLiquid)
    {
        filled = BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
    }

    if (filled < 0)
    {
        filled *= -1;
        //filled -= 0.11111111F; //Why this is needed.. not sure...
        return eyes > pos.getY() + 1 + (1 - filled);
    }
    else
    {
        return eyes < pos.getY() + 1 + filled;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:ForgeHooks.java

示例5: handleMaterialAcceleration

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
/**
 * handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
 */
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
    int i = MathHelper.floor_double(bb.minX);
    int j = MathHelper.floor_double(bb.maxX + 1.0D);
    int k = MathHelper.floor_double(bb.minY);
    int l = MathHelper.floor_double(bb.maxY + 1.0D);
    int i1 = MathHelper.floor_double(bb.minZ);
    int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);

    if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
    {
        return false;
    }
    else
    {
        boolean flag = false;
        Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = k; l1 < l; ++l1)
            {
                for (int i2 = i1; i2 < j1; ++i2)
                {
                    blockpos$mutableblockpos.func_181079_c(k1, l1, i2);
                    IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos);
                    Block block = iblockstate.getBlock();

                    if (block.getMaterial() == materialIn)
                    {
                        double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));

                        if ((double)l >= d0)
                        {
                            flag = true;
                            vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3);
                        }
                    }
                }
            }
        }

        if (vec3.lengthVector() > 0.0D && entityIn.isPushedByWater())
        {
            vec3 = vec3.normalize();
            double d1 = 0.014D;
            entityIn.motionX += vec3.xCoord * d1;
            entityIn.motionY += vec3.yCoord * d1;
            entityIn.motionZ += vec3.zCoord * d1;
        }

        return flag;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:59,代码来源:World.java

示例6: getFluidHeight

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Material blockMaterial)
{
    int i = 0;
    float f = 0.0F;

    for (int j = 0; j < 4; ++j)
    {
        BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));

        if (blockAccess.getBlockState(blockpos.up()).getMaterial() == blockMaterial)
        {
            return 1.0F;
        }

        IBlockState iblockstate = blockAccess.getBlockState(blockpos);
        Material material = iblockstate.getMaterial();

        if (material != blockMaterial)
        {
            if (!material.isSolid())
            {
                ++f;
                ++i;
            }
        }
        else
        {
            int k = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();

            if (k >= 8 || k == 0)
            {
                f += BlockLiquid.getLiquidHeightPercent(k) * 10.0F;
                i += 10;
            }

            f += BlockLiquid.getLiquidHeightPercent(k);
            ++i;
        }
    }

    return 1.0F - f / (float)i;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:43,代码来源:BlockFluidRenderer.java

示例7: onUpdate

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.motionY -= (double)this.particleGravity;
    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.9800000190734863D;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= 0.9800000190734863D;

    if (this.particleMaxAge-- <= 0)
    {
        this.setDead();
    }

    if (this.onGround)
    {
        if (Math.random() < 0.5D)
        {
            this.setDead();
        }

        this.motionX *= 0.699999988079071D;
        this.motionZ *= 0.699999988079071D;
    }

    BlockPos blockpos = new BlockPos(this);
    IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
    Block block = iblockstate.getBlock();
    block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
    Material material = iblockstate.getBlock().getMaterial();

    if (material.isLiquid() || material.isSolid())
    {
        double d0 = 0.0D;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
        }
        else
        {
            d0 = block.getBlockBoundsMaxY();
        }

        double d1 = (double)MathHelper.floor_double(this.posY) + d0;

        if (this.posY < d1)
        {
            this.setDead();
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:58,代码来源:EntityRainFX.java

示例8: onUpdate

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.motionY -= (double)this.particleGravity;
    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.9800000190734863D;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= 0.9800000190734863D;

    if (this.particleMaxAge-- <= 0)
    {
        this.setExpired();
    }

    if (this.isCollided)
    {
        if (Math.random() < 0.5D)
        {
            this.setExpired();
        }

        this.motionX *= 0.699999988079071D;
        this.motionZ *= 0.699999988079071D;
    }

    BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
    IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
    Material material = iblockstate.getMaterial();

    if (material.isLiquid() || material.isSolid())
    {
        double d0;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
        }
        else
        {
            d0 = iblockstate.getBoundingBox(this.worldObj, blockpos).maxY;
        }

        double d1 = (double)MathHelper.floor_double(this.posY) + d0;

        if (this.posY < d1)
        {
            this.setExpired();
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:53,代码来源:ParticleRain.java

示例9: getFluidHeight

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Material blockMaterial)
{
    int i = 0;
    float f = 0.0F;

    for (int j = 0; j < 4; ++j)
    {
        BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));

        if (blockAccess.getBlockState(blockpos.up()).getBlock().getMaterial() == blockMaterial)
        {
            return 1.0F;
        }

        IBlockState iblockstate = blockAccess.getBlockState(blockpos);
        Material material = iblockstate.getBlock().getMaterial();

        if (material != blockMaterial)
        {
            if (!material.isSolid())
            {
                ++f;
                ++i;
            }
        }
        else
        {
            int k = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();

            if (k >= 8 || k == 0)
            {
                f += BlockLiquid.getLiquidHeightPercent(k) * 10.0F;
                i += 10;
            }

            f += BlockLiquid.getLiquidHeightPercent(k);
            ++i;
        }
    }

    return 1.0F - f / (float)i;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:43,代码来源:BlockFluidRenderer.java

示例10: onUpdate

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.motionY -= (double)this.particleGravity;
    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.9800000190734863D;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= 0.9800000190734863D;

    if (this.particleMaxAge-- <= 0)
    {
        this.setExpired();
    }

    if (this.isCollided)
    {
        if (Math.random() < 0.5D)
        {
            this.setExpired();
        }

        this.motionX *= 0.699999988079071D;
        this.motionZ *= 0.699999988079071D;
    }

    BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
    IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
    Material material = iblockstate.getMaterial();

    if (material.isLiquid() || material.isSolid())
    {
        double d0;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
        }
        else
        {
            d0 = iblockstate.getBoundingBox(this.worldObj, blockpos).maxY;
        }

        double d1 = (double)MathHelper.floor(this.posY) + d0;

        if (this.posY < d1)
        {
            this.setExpired();
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:53,代码来源:ParticleRain.java

示例11: handleMaterialAcceleration

import net.minecraft.block.BlockLiquid; //导入方法依赖的package包/类
/**
 * handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
 */
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
    int i = MathHelper.floor(bb.minX);
    int j = MathHelper.ceil(bb.maxX);
    int k = MathHelper.floor(bb.minY);
    int l = MathHelper.ceil(bb.maxY);
    int i1 = MathHelper.floor(bb.minZ);
    int j1 = MathHelper.ceil(bb.maxZ);

    if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
    {
        return false;
    }
    else
    {
        boolean flag = false;
        Vec3d vec3d = Vec3d.ZERO;
        BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = k; l1 < l; ++l1)
            {
                for (int i2 = i1; i2 < j1; ++i2)
                {
                    blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
                    IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
                    Block block = iblockstate.getBlock();

                    if (iblockstate.getMaterial() == materialIn)
                    {
                        double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));

                        if ((double)l >= d0)
                        {
                            flag = true;
                            vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
                        }
                    }
                }
            }
        }

        blockpos$pooledmutableblockpos.release();

        if (vec3d.lengthVector() > 0.0D && entityIn.isPushedByWater())
        {
            vec3d = vec3d.normalize();
            double d1 = 0.014D;
            entityIn.motionX += vec3d.xCoord * 0.014D;
            entityIn.motionY += vec3d.yCoord * 0.014D;
            entityIn.motionZ += vec3d.zCoord * 0.014D;
        }

        return flag;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:World.java


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