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


Java BlockFluid.getFluidHeightPercent方法代码示例

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


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

示例1: getBlockIdAtEntityViewpoint

import net.minecraft.block.BlockFluid; //导入方法依赖的package包/类
/**
 * Returns the block ID at the current camera location (either air or fluid), taking into account the height of
 * fluid blocks
 */
public static int getBlockIdAtEntityViewpoint(World par0World, EntityLivingBase par1EntityLivingBase, float par2)
{
    Vec3 vec3 = projectViewFromEntity(par1EntityLivingBase, (double)par2);
    ChunkPosition chunkposition = new ChunkPosition(vec3);
    int i = par0World.getBlockId(chunkposition.x, chunkposition.y, chunkposition.z);

    if (i != 0 && Block.blocksList[i].blockMaterial.isLiquid())
    {
        float f1 = BlockFluid.getFluidHeightPercent(par0World.getBlockMetadata(chunkposition.x, chunkposition.y, chunkposition.z)) - 0.11111111F;
        float f2 = (float)(chunkposition.y + 1) - f1;

        if (vec3.yCoord >= (double)f2)
        {
            i = par0World.getBlockId(chunkposition.x, chunkposition.y + 1, chunkposition.z);
        }
    }

    return i;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:ActiveRenderInfo.java

示例2: onUpdate

import net.minecraft.block.BlockFluid; //导入方法依赖的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;
    }

    Material material = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));

    if (material.isLiquid() || material.isSolid())
    {
        double d0 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))));

        if (this.posY < d0)
        {
            this.setDead();
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:43,代码来源:EntityRainFX.java

示例3: getFluidHeight

import net.minecraft.block.BlockFluid; //导入方法依赖的package包/类
/**
 * Get fluid height
 */
public float getFluidHeight(int par1, int par2, int par3, Material par4Material)
{
    int l = 0;
    float f = 0.0F;

    for (int i1 = 0; i1 < 4; ++i1)
    {
        int j1 = par1 - (i1 & 1);
        int k1 = par3 - (i1 >> 1 & 1);

        if (this.blockAccess.getBlockMaterial(j1, par2 + 1, k1) == par4Material)
        {
            return 1.0F;
        }

        Material material1 = this.blockAccess.getBlockMaterial(j1, par2, k1);

        if (material1 == par4Material)
        {
            int l1 = this.blockAccess.getBlockMetadata(j1, par2, k1);

            if (l1 >= 8 || l1 == 0)
            {
                f += BlockFluid.getFluidHeightPercent(l1) * 10.0F;
                l += 10;
            }

            f += BlockFluid.getFluidHeightPercent(l1);
            ++l;
        }
        else if (!material1.isSolid())
        {
            ++f;
            ++l;
        }
    }

    return 1.0F - f / (float)l;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:43,代码来源:RenderBlocks.java

示例4: handleMaterialAcceleration

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

    if (!this.checkChunksExist(i, k, i1, j, l, j1))
    {
        return false;
    }
    else
    {
        boolean flag = false;
        Vec3 vec3 = this.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);

        for (int k1 = i; k1 < j; ++k1)
        {
            for (int l1 = k; l1 < l; ++l1)
            {
                for (int i2 = i1; i2 < j1; ++i2)
                {
                    Block block = Block.blocksList[this.getBlockId(k1, l1, i2)];

                    if (block != null && block.blockMaterial == par2Material)
                    {
                        double d0 = (double)((float)(l1 + 1) - BlockFluid.getFluidHeightPercent(this.getBlockMetadata(k1, l1, i2)));

                        if ((double)l >= d0)
                        {
                            flag = true;
                            block.velocityToAddToEntity(this, k1, l1, i2, par3Entity, vec3);
                        }
                    }
                }
            }
        }

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

        return flag;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:56,代码来源:World.java

示例5: onUpdate

import net.minecraft.block.BlockFluid; //导入方法依赖的package包/类
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;

    if (this.materialType == Material.water)
    {
        this.particleRed = 0.2F;
        this.particleGreen = 0.3F;
        this.particleBlue = 1.0F;
    }
    else
    {
        this.particleRed = 1.0F;
        this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16);
        this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8);
    }

    this.motionY -= (double)this.particleGravity;

    if (this.bobTimer-- > 0)
    {
        this.motionX *= 0.02D;
        this.motionY *= 0.02D;
        this.motionZ *= 0.02D;
        this.setParticleTextureIndex(113);
    }
    else
    {
        this.setParticleTextureIndex(112);
    }

    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 (this.materialType == Material.water)
        {
            this.setDead();
            this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
        }
        else
        {
            this.setParticleTextureIndex(114);
        }

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

    Material material = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));

    if (material.isLiquid() || material.isSolid())
    {
        double d0 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))));

        if (this.posY < d0)
        {
            this.setDead();
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:75,代码来源:EntityDropParticleFX.java


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