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


Java World.doesBlockHaveSolidTopSurface方法代码示例

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


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

示例1: getActualState

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();

    if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down()))
    {
        boolean flag = (i + j + k & 1) == 1;
        boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1;
        int l = 0;

        if (this.canCatchFire(worldIn, pos.up()))
        {
            l = flag ? 1 : 2;
        }

        return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag));
    }
    else
    {
        return this.getDefaultState();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:BlockFire.java

示例2: func_179861_a

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean func_179861_a(BlockPos p_179861_1_, BlockPos p_179861_2_)
{
    if (!World.doesBlockHaveSolidTopSurface(this.worldObj, p_179861_2_.down()))
    {
        return false;
    }
    else
    {
        int i = p_179861_2_.getX() - p_179861_1_.getX() / 2;
        int j = p_179861_2_.getZ() - p_179861_1_.getZ() / 2;

        for (int k = i; k < i + p_179861_1_.getX(); ++k)
        {
            for (int l = p_179861_2_.getY(); l < p_179861_2_.getY() + p_179861_1_.getY(); ++l)
            {
                for (int i1 = j; i1 < j + p_179861_1_.getZ(); ++i1)
                {
                    if (this.worldObj.getBlockState(new BlockPos(k, l, i1)).getBlock().isNormalCube())
                    {
                        return false;
                    }
                }
            }
        }

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

示例3: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (worldIn.provider.getDimensionId() > 0 || !Blocks.portal.func_176548_d(worldIn, pos))
    {
        if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !this.canNeighborCatchFire(worldIn, pos))
        {
            worldIn.setBlockToAir(pos);
        }
        else
        {
            worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + worldIn.rand.nextInt(10));
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:BlockFire.java

示例4: updateTask

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Updates the task
 */
public void updateTask()
{
    this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed());

    if (!this.thePet.isSitting())
    {
        if (--this.field_75343_h <= 0)
        {
            this.field_75343_h = 10;

            if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.followSpeed))
            {
                if (!this.thePet.getLeashed())
                {
                    if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
                    {
                        int i = MathHelper.floor_double(this.theOwner.posX) - 2;
                        int j = MathHelper.floor_double(this.theOwner.posZ) - 2;
                        int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY);

                        for (int l = 0; l <= 4; ++l)
                        {
                            for (int i1 = 0; i1 <= 4; ++i1)
                            {
                                if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(this.theWorld, new BlockPos(i + l, k - 1, j + i1)) && this.func_181065_a(new BlockPos(i + l, k, j + i1)) && this.func_181065_a(new BlockPos(i + l, k + 1, j + i1)))
                                {
                                    this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch);
                                    this.petPathfinder.clearPathEntity();
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:42,代码来源:EntityAIFollowOwner.java

示例5: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue();
    boolean flag1 = !World.doesBlockHaveSolidTopSurface(worldIn, pos.down());

    if (flag != flag1)
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:BlockTripWire.java

示例6: canPlaceBlockAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:BlockPumpkin.java

示例7: canBePlacedOn

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean canBePlacedOn(World worldIn, BlockPos pos)
{
    return World.doesBlockHaveSolidTopSurface(worldIn, pos) || worldIn.getBlockState(pos).getBlock() instanceof BlockFence;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:BlockBasePressurePlate.java

示例8: canPlaceBlockAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    return World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockRailBase.java

示例9: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (((Boolean)state.getValue(WET)).booleanValue())
    {
        EnumFacing enumfacing = EnumFacing.random(rand);

        if (enumfacing != EnumFacing.UP && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offset(enumfacing)))
        {
            double d0 = (double)pos.getX();
            double d1 = (double)pos.getY();
            double d2 = (double)pos.getZ();

            if (enumfacing == EnumFacing.DOWN)
            {
                d1 = d1 - 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            }
            else
            {
                d1 = d1 + rand.nextDouble() * 0.8D;

                if (enumfacing.getAxis() == EnumFacing.Axis.X)
                {
                    d2 += rand.nextDouble();

                    if (enumfacing == EnumFacing.EAST)
                    {
                        ++d0;
                    }
                    else
                    {
                        d0 += 0.05D;
                    }
                }
                else
                {
                    d0 += rand.nextDouble();

                    if (enumfacing == EnumFacing.SOUTH)
                    {
                        ++d2;
                    }
                    else
                    {
                        d2 += 0.05D;
                    }
                }
            }

            worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:55,代码来源:BlockSponge.java

示例10: canPlaceBlockAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    return super.canPlaceBlockAt(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockFlowerPot.java

示例11: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (!worldIn.isRemote)
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty());
        boolean flag = false;

        if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))
        {
            flag = true;
        }

        if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.east()))
        {
            flag = true;
        }
        else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.west()))
        {
            flag = true;
        }
        else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.north()))
        {
            flag = true;
        }
        else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.south()))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
        }
        else
        {
            this.onNeighborChangedInternal(worldIn, pos, state, neighborBlock);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:44,代码来源:BlockRailBase.java

示例12: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER)
    {
        BlockPos blockpos = pos.down();
        IBlockState iblockstate = worldIn.getBlockState(blockpos);

        if (iblockstate.getBlock() != this)
        {
            worldIn.setBlockToAir(pos);
        }
        else if (neighborBlock != this)
        {
            this.onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
        }
    }
    else
    {
        boolean flag1 = false;
        BlockPos blockpos1 = pos.up();
        IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);

        if (iblockstate1.getBlock() != this)
        {
            worldIn.setBlockToAir(pos);
            flag1 = true;
        }

        if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))
        {
            worldIn.setBlockToAir(pos);
            flag1 = true;

            if (iblockstate1.getBlock() == this)
            {
                worldIn.setBlockToAir(blockpos1);
            }
        }

        if (flag1)
        {
            if (!worldIn.isRemote)
            {
                this.dropBlockAsItem(worldIn, pos, state, 0);
            }
        }
        else
        {
            boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1);

            if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != ((Boolean)iblockstate1.getValue(POWERED)).booleanValue())
            {
                worldIn.setBlockState(blockpos1, iblockstate1.withProperty(POWERED, Boolean.valueOf(flag)), 2);

                if (flag != ((Boolean)state.getValue(OPEN)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
                    worldIn.markBlockRangeForRenderUpdate(pos, pos);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0);
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:68,代码来源:BlockDoor.java

示例13: canPlaceBlockAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) || this.canNeighborCatchFire(worldIn, pos);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:BlockFire.java

示例14: canPlaceBlockAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
	return World.doesBlockHaveSolidTopSurface(worldIn, pos.down())
			|| worldIn.getBlockState(pos.down()).getBlock() == Blocks.glowstone;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:BlockRedstoneWire.java

示例15: hasRoomForPlayer

import net.minecraft.world.World; //导入方法依赖的package包/类
protected static boolean hasRoomForPlayer(World worldIn, BlockPos pos)
{
    return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.getBlockState(pos.up()).getBlock().getMaterial().isSolid();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockBed.java


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