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


Java Material.isSolid方法代码示例

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


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

示例1: canBlockStay

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos)
{
    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        Material material = worldIn.getBlockState(pos.offset(enumfacing)).getMaterial();

        if (material.isSolid() || material == Material.LAVA)
        {
            return false;
        }
    }

    Block block = worldIn.getBlockState(pos.down()).getBlock();
    return block == Blocks.CACTUS || block == Blocks.SAND && !worldIn.getBlockState(pos.up()).getMaterial().isLiquid();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:BlockCactus.java

示例2: canBlockStay

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos)
{
    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        Material material = worldIn.getBlockState(pos.offset(enumfacing)).getMaterial();

        if (material.isSolid() || material == Material.LAVA)
        {
            return false;
        }
    }

    IBlockState state = worldIn.getBlockState(pos.down());
    return state.getBlock().canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).getMaterial().isLiquid();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:BlockCactus.java

示例3: tryPlaceContainedLiquid

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos)
{
    if (this.isFull == Blocks.air)
    {
        return false;
    }
    else
    {
        Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
        boolean flag = !material.isSolid();

        if (!worldIn.isAirBlock(pos) && !flag)
        {
            return false;
        }
        else
        {
            if (worldIn.provider.doesWaterVaporize() && this.isFull == Blocks.flowing_water)
            {
                int i = pos.getX();
                int j = pos.getY();
                int k = pos.getZ();
                worldIn.playSoundEffect((double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

                for (int l = 0; l < 8; ++l)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
                }
            }
            else
            {
                if (!worldIn.isRemote && flag && !material.isLiquid())
                {
                    worldIn.destroyBlock(pos, true);
                }

                worldIn.setBlockState(pos, this.isFull.getDefaultState(), 3);
            }

            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:44,代码来源:ItemBucket.java

示例4: onUpdate

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

示例5: getFluidHeight

import net.minecraft.block.material.Material; //导入方法依赖的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:Notoh,项目名称:DecompiledMinecraft,代码行数:43,代码来源:BlockFluidRenderer.java

示例6: onUpdate

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

示例7: getIsSolid

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public static boolean getIsSolid(Material mat) {
    return mat.isSolid();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:4,代码来源:ZWrapper.java

示例8: tryPlaceContainedLiquid

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean tryPlaceContainedLiquid(@Nullable EntityPlayer player, World worldIn, BlockPos posIn)
{
    if (this.containedBlock == Blocks.AIR)
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(posIn);
        Material material = iblockstate.getMaterial();
        boolean flag = !material.isSolid();
        boolean flag1 = iblockstate.getBlock().isReplaceable(worldIn, posIn);

        if (!worldIn.isAirBlock(posIn) && !flag && !flag1)
        {
            return false;
        }
        else
        {
            if (worldIn.provider.doesWaterVaporize() && this.containedBlock == Blocks.FLOWING_WATER)
            {
                int l = posIn.getX();
                int i = posIn.getY();
                int j = posIn.getZ();
                worldIn.playSound(player, posIn, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

                for (int k = 0; k < 8; ++k)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)l + Math.random(), (double)i + Math.random(), (double)j + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
                }
            }
            else
            {
                if (!worldIn.isRemote && (flag || flag1) && !material.isLiquid())
                {
                    worldIn.destroyBlock(posIn, true);
                }

                SoundEvent soundevent = this.containedBlock == Blocks.FLOWING_LAVA ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
                worldIn.playSound(player, posIn, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
                worldIn.setBlockState(posIn, this.containedBlock.getDefaultState(), 11);
            }

            return true;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:48,代码来源:ItemBucket.java

示例9: onUpdate

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
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.setExpired();
    }

    if (this.isCollided)
    {
        if (this.materialType == Material.WATER)
        {
            this.setExpired();
            this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
        }
        else
        {
            this.setParticleTextureIndex(114);
        }

        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 = 0.0D;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue());
        }

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

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

示例10: onUpdate

import net.minecraft.block.material.Material; //导入方法依赖的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: getFluidHeight

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

示例12: tryPlaceFluid

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
 * Tries to place a fluid in the world in block form.
 * Makes a fluid emptying sound when successful.
 * Checks if water-like fluids should vaporize like in the nether.
 *
 * Modeled after {@link net.minecraft.item.ItemBucket#tryPlaceContainedLiquid(EntityPlayer, World, BlockPos)}
 *
 * @param player     Player who places the fluid. May be null for blocks like dispensers.
 * @param worldIn    World to place the fluid in
 * @param fluidStack The fluidStack to place.
 * @param pos        The position in the world to place the fluid block
 * @return true if successful
 */
public static boolean tryPlaceFluid(@Nullable EntityPlayer player, World worldIn, FluidStack fluidStack, BlockPos pos)
{
    if (worldIn == null || fluidStack == null || pos == null)
    {
        return false;
    }

    Fluid fluid = fluidStack.getFluid();
    if (fluid == null || !fluid.canBePlacedInWorld())
    {
        return false;
    }

    // check that we can place the fluid at the destination
    IBlockState destBlockState = worldIn.getBlockState(pos);
    Material destMaterial = destBlockState.getMaterial();
    boolean isDestNonSolid = !destMaterial.isSolid();
    boolean isDestReplaceable = destBlockState.getBlock().isReplaceable(worldIn, pos);
    if (!worldIn.isAirBlock(pos) && !isDestNonSolid && !isDestReplaceable)
    {
        return false; // Non-air, solid, unreplacable block. We can't put fluid here.
    }

    if (worldIn.provider.doesWaterVaporize() && fluid.doesVaporize(fluidStack))
    {
        fluid.vaporize(player, worldIn, pos, fluidStack);
    }
    else
    {
        if (!worldIn.isRemote && (isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid())
        {
            worldIn.destroyBlock(pos, true);
        }

        SoundEvent soundevent = fluid.getEmptySound(fluidStack);
        worldIn.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);

        IBlockState fluidBlockState = fluid.getBlock().getDefaultState();
        worldIn.setBlockState(pos, fluidBlockState, 11);
    }
    return true;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:56,代码来源:FluidUtil.java

示例13: onUpdate

import net.minecraft.block.material.Material; //导入方法依赖的package包/类
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.setExpired();
    }

    if (this.isCollided)
    {
        if (this.materialType == Material.WATER)
        {
            this.setExpired();
            this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
        }
        else
        {
            this.setParticleTextureIndex(114);
        }

        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 = 0.0D;

        if (iblockstate.getBlock() instanceof BlockLiquid)
        {
            d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue());
        }

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

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


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