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


Java BlockPos.south方法代码示例

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


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

示例1: updateLightmap

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z)
{
    float e1 = 1 - 1e-2f;
    float e2 = 0.95f;
    BlockPos pos = blockInfo.getBlockPos();

    boolean full = blockInfo.getState().isFullCube();

    if((full || y < -e1) && normal[1] < -e2) pos = pos.down();
    if((full || y >  e1) && normal[1] >  e2) pos = pos.up();
    if((full || z < -e1) && normal[2] < -e2) pos = pos.north();
    if((full || z >  e1) && normal[2] >  e2) pos = pos.south();
    if((full || x < -e1) && normal[0] < -e2) pos = pos.west();
    if((full || x >  e1) && normal[0] >  e2) pos = pos.east();

    int brightness = blockInfo.getState().getPackedLightmapCoords(blockInfo.getWorld(), pos);

    lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF;
    lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:VertexLighterFlat.java

示例2: leavesGenOliveImplLayer

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public static void leavesGenOliveImplLayer(ITreeGenerator gen, World w, BlockPos at, int layer)
{
    for (int dx = -3; dx <= 3; ++dx)
    {
        for (int dz = -3; dz <= 3; ++dz)
        {
            int dist = Math.abs(dx) + Math.abs(dz);
            if (dist <= layer)
            {
                BlockPos offset = at.add(dx, 0, dz);
                BlockPos[] offsets = { offset, offset.west(), offset.south(), offset.south().west() };
                for (BlockPos blockPos : offsets)
                {
                    if (w.getBlockState(blockPos).getBlock().canBeReplacedByLeaves(w.getBlockState(blockPos), w, blockPos))
                    {
                        w.setBlockState(blockPos, gen.getLeaves(), 2);
                    }
                }
            }
        }
    }
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:23,代码来源:TreeGenImpl.java

示例3: getGrowthChance

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
{
    float f = 1.0F;
    BlockPos blockpos1 = pos.down();

    for (int i = -1; i <= 1; ++i)
    {
        for (int j = -1; j <= 1; ++j)
        {
            float f1 = 0.0F;
            IBlockState iblockstate = worldIn.getBlockState(blockpos1.add(i, 0, j));

            if (iblockstate.getBlock().canSustainPlant(worldIn.getBlockState(blockpos1.add(i, 0, j)),
                    worldIn, blockpos1.add(i, 0, j), EnumFacing.UP, (IPlantable)blockIn))
            {
                f1 = 1.0F;

                if (iblockstate.getBlock().isFertile(worldIn, blockpos1.add(i, 0, j)))
                {
                    f1 = 3.0F;
                }
            }

            if (i != 0 || j != 0)
            {
                f1 /= 4.0F;
            }

            f += f1;
        }
    }

    BlockPos blockpos2 = pos.north();
    BlockPos blockpos3 = pos.south();
    BlockPos blockpos4 = pos.west();
    BlockPos blockpos5 = pos.east();
    boolean flag = blockIn == worldIn.getBlockState(blockpos4).getBlock() || blockIn == worldIn.getBlockState(blockpos5).getBlock();
    boolean flag1 = blockIn == worldIn.getBlockState(blockpos2).getBlock() || blockIn == worldIn.getBlockState(blockpos3).getBlock();

    if (flag && flag1)
    {
        f /= 2.0F;
    }
    else
    {
        boolean flag2 = blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos5.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos5.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock();

        if (flag2)
        {
            f /= 2.0F;
        }
    }

    return f;
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:56,代码来源:BlockGeneraCrop.java

示例4: spawn

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public static boolean spawn(World world, BlockPos targetPos, EnumFacing targetSide, int actionId, boolean doSound) {
    BlockPos p;
    if (validSpawnPoint(world, targetPos.offset(targetSide))) {
        p = targetPos.offset(targetSide);
    } else if (validSpawnPoint(world, targetPos.north())) {
        p = targetPos.north();
    } else if (validSpawnPoint(world, targetPos.south())) {
        p = targetPos.south();
    } else if (validSpawnPoint(world, targetPos.east())) {
        p = targetPos.east();
    } else if (validSpawnPoint(world, targetPos.west())) {
        p = targetPos.west();
    } else if (validSpawnPoint(world, targetPos.up())) {
        p = targetPos.up();
    } else {
        return false;
    }
    EntityMeeCreeps entity = new EntityMeeCreeps(world);
    entity.setLocationAndAngles(p.getX()+.5, p.getY(), p.getZ()+.5, 0, 0);
    entity.setActionId(actionId);
    world.spawnEntity(entity);

    if (doSound && Config.meeCreepVolume > 0.01f) {
        String snd = "intro1";
        switch (entity.getRandom().nextInt(4)) {
            case 0:
                snd = "intro1";
                break;
            case 1:
                snd = "intro2";
                break;
            case 2:
                snd = "intro3";
                break;
            case 3:
                snd = "intro4";
                break;
        }
        SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(MeeCreeps.MODID, snd));
        SoundTools.playSound(world, sound, p.getX(), p.getY(), p.getZ(), Config.meeCreepVolume, 1);
    }

    return true;
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:45,代码来源:ActionOptions.java

示例5: generate

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getMaterial() == Material.AIR || iblockstate.getMaterial() == Material.LEAVES) && position.getY() > 1; iblockstate = worldIn.getBlockState(position))
    {
        position = position.down();
    }

    if (position.getY() < 1)
    {
        return false;
    }
    else
    {
        position = position.up();

        for (int i = 0; i < 4; ++i)
        {
            BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4));

            if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).isFullyOpaque())
            {
                worldIn.setBlockState(blockpos, Blocks.CHEST.getDefaultState(), 2);
                TileEntity tileentity = worldIn.getTileEntity(blockpos);

                if (tileentity instanceof TileEntityChest)
                {
                    ((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_SPAWN_BONUS_CHEST, rand.nextLong());
                }

                BlockPos blockpos1 = blockpos.east();
                BlockPos blockpos2 = blockpos.west();
                BlockPos blockpos3 = blockpos.north();
                BlockPos blockpos4 = blockpos.south();

                if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).isFullyOpaque())
                {
                    worldIn.setBlockState(blockpos2, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).isFullyOpaque())
                {
                    worldIn.setBlockState(blockpos1, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).isFullyOpaque())
                {
                    worldIn.setBlockState(blockpos3, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).isFullyOpaque())
                {
                    worldIn.setBlockState(blockpos4, Blocks.TORCH.getDefaultState(), 2);
                }

                return true;
            }
        }

        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:62,代码来源:WorldGeneratorBonusChest.java

示例6: getGrowthChance

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
{
    float f = 1.0F;
    BlockPos blockpos = pos.down();

    for (int i = -1; i <= 1; ++i)
    {
        for (int j = -1; j <= 1; ++j)
        {
            float f1 = 0.0F;
            IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));

            if (iblockstate.getBlock() == Blocks.FARMLAND)
            {
                f1 = 1.0F;

                if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0)
                {
                    f1 = 3.0F;
                }
            }

            if (i != 0 || j != 0)
            {
                f1 /= 4.0F;
            }

            f += f1;
        }
    }

    BlockPos blockpos1 = pos.north();
    BlockPos blockpos2 = pos.south();
    BlockPos blockpos3 = pos.west();
    BlockPos blockpos4 = pos.east();
    boolean flag = blockIn == worldIn.getBlockState(blockpos3).getBlock() || blockIn == worldIn.getBlockState(blockpos4).getBlock();
    boolean flag1 = blockIn == worldIn.getBlockState(blockpos1).getBlock() || blockIn == worldIn.getBlockState(blockpos2).getBlock();

    if (flag && flag1)
    {
        f /= 2.0F;
    }
    else
    {
        boolean flag2 = blockIn == worldIn.getBlockState(blockpos3.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos3.south()).getBlock();

        if (flag2)
        {
            f /= 2.0F;
        }
    }

    return f;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:BlockCrops.java

示例7: onBlockPlacedBy

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
    state = state.withProperty(FACING, enumfacing);
    BlockPos blockpos = pos.north();
    BlockPos blockpos1 = pos.south();
    BlockPos blockpos2 = pos.west();
    BlockPos blockpos3 = pos.east();
    boolean flag = this == worldIn.getBlockState(blockpos).getBlock();
    boolean flag1 = this == worldIn.getBlockState(blockpos1).getBlock();
    boolean flag2 = this == worldIn.getBlockState(blockpos2).getBlock();
    boolean flag3 = this == worldIn.getBlockState(blockpos3).getBlock();

    if (!flag && !flag1 && !flag2 && !flag3)
    {
        worldIn.setBlockState(pos, state, 3);
    }
    else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1)
    {
        if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3))
        {
            if (flag2)
            {
                worldIn.setBlockState(blockpos2, state, 3);
            }
            else
            {
                worldIn.setBlockState(blockpos3, state, 3);
            }

            worldIn.setBlockState(pos, state, 3);
        }
    }
    else
    {
        if (flag)
        {
            worldIn.setBlockState(blockpos, state, 3);
        }
        else
        {
            worldIn.setBlockState(blockpos1, state, 3);
        }

        worldIn.setBlockState(pos, state, 3);
    }

    if (stack.hasDisplayName())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            ((TileEntityChest)tileentity).func_190575_a(stack.getDisplayName());
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:BlockChest.java

示例8: canPlaceBlockAt

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    int i = 0;
    BlockPos blockpos = pos.west();
    BlockPos blockpos1 = pos.east();
    BlockPos blockpos2 = pos.north();
    BlockPos blockpos3 = pos.south();

    if (worldIn.getBlockState(blockpos).getBlock() == this)
    {
        if (this.isDoubleChest(worldIn, blockpos))
        {
            return false;
        }

        ++i;
    }

    if (worldIn.getBlockState(blockpos1).getBlock() == this)
    {
        if (this.isDoubleChest(worldIn, blockpos1))
        {
            return false;
        }

        ++i;
    }

    if (worldIn.getBlockState(blockpos2).getBlock() == this)
    {
        if (this.isDoubleChest(worldIn, blockpos2))
        {
            return false;
        }

        ++i;
    }

    if (worldIn.getBlockState(blockpos3).getBlock() == this)
    {
        if (this.isDoubleChest(worldIn, blockpos3))
        {
            return false;
        }

        ++i;
    }

    return i <= 1;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:51,代码来源:BlockChest.java

示例9: generate

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 1; iblockstate = worldIn.getBlockState(position))
    {
        position = position.down();
    }

    if (position.getY() < 1)
    {
        return false;
    }
    else
    {
        position = position.up();

        for (int i = 0; i < 4; ++i)
        {
            BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4));

            if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), net.minecraft.util.EnumFacing.UP))
            {
                worldIn.setBlockState(blockpos, Blocks.CHEST.getDefaultState(), 2);
                TileEntity tileentity = worldIn.getTileEntity(blockpos);

                if (tileentity instanceof TileEntityChest)
                {
                    ((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_SPAWN_BONUS_CHEST, rand.nextLong());
                }

                BlockPos blockpos1 = blockpos.east();
                BlockPos blockpos2 = blockpos.west();
                BlockPos blockpos3 = blockpos.north();
                BlockPos blockpos4 = blockpos.south();

                if (worldIn.isAirBlock(blockpos2) && worldIn.getBlockState(blockpos2.down()).isSideSolid(worldIn, blockpos2.down(), net.minecraft.util.EnumFacing.UP))
                {
                    worldIn.setBlockState(blockpos2, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos1) && worldIn.getBlockState(blockpos1.down()).isSideSolid(worldIn, blockpos1.down(), net.minecraft.util.EnumFacing.UP))
                {
                    worldIn.setBlockState(blockpos1, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos3) && worldIn.getBlockState(blockpos3.down()).isSideSolid(worldIn, blockpos3.down(), net.minecraft.util.EnumFacing.UP))
                {
                    worldIn.setBlockState(blockpos3, Blocks.TORCH.getDefaultState(), 2);
                }

                if (worldIn.isAirBlock(blockpos4) && worldIn.getBlockState(blockpos4.down()).isSideSolid(worldIn, blockpos4.down(), net.minecraft.util.EnumFacing.UP))
                {
                    worldIn.setBlockState(blockpos4, Blocks.TORCH.getDefaultState(), 2);
                }

                return true;
            }
        }

        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:62,代码来源:WorldGeneratorBonusChest.java

示例10: getGrowthChance

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
{
    float f = 1.0F;
    BlockPos blockpos = pos.down();

    for (int i = -1; i <= 1; ++i)
    {
        for (int j = -1; j <= 1; ++j)
        {
            float f1 = 0.0F;
            IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));

            if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn))
            {
                f1 = 1.0F;

                if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j)))
                {
                    f1 = 3.0F;
                }
            }

            if (i != 0 || j != 0)
            {
                f1 /= 4.0F;
            }

            f += f1;
        }
    }

    BlockPos blockpos1 = pos.north();
    BlockPos blockpos2 = pos.south();
    BlockPos blockpos3 = pos.west();
    BlockPos blockpos4 = pos.east();
    boolean flag = blockIn == worldIn.getBlockState(blockpos3).getBlock() || blockIn == worldIn.getBlockState(blockpos4).getBlock();
    boolean flag1 = blockIn == worldIn.getBlockState(blockpos1).getBlock() || blockIn == worldIn.getBlockState(blockpos2).getBlock();

    if (flag && flag1)
    {
        f /= 2.0F;
    }
    else
    {
        boolean flag2 = blockIn == worldIn.getBlockState(blockpos3.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos3.south()).getBlock();

        if (flag2)
        {
            f /= 2.0F;
        }
    }

    return f;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:55,代码来源:BlockCrops.java

示例11: onBlockPlacedBy

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
    state = state.withProperty(FACING, enumfacing);
    BlockPos blockpos = pos.north();
    BlockPos blockpos1 = pos.south();
    BlockPos blockpos2 = pos.west();
    BlockPos blockpos3 = pos.east();
    boolean flag = this == worldIn.getBlockState(blockpos).getBlock();
    boolean flag1 = this == worldIn.getBlockState(blockpos1).getBlock();
    boolean flag2 = this == worldIn.getBlockState(blockpos2).getBlock();
    boolean flag3 = this == worldIn.getBlockState(blockpos3).getBlock();

    if (!flag && !flag1 && !flag2 && !flag3)
    {
        worldIn.setBlockState(pos, state, 3);
    }
    else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1)
    {
        if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3))
        {
            if (flag2)
            {
                worldIn.setBlockState(blockpos2, state, 3);
            }
            else
            {
                worldIn.setBlockState(blockpos3, state, 3);
            }

            worldIn.setBlockState(pos, state, 3);
        }
    }
    else
    {
        if (flag)
        {
            worldIn.setBlockState(blockpos, state, 3);
        }
        else
        {
            worldIn.setBlockState(blockpos1, state, 3);
        }

        worldIn.setBlockState(pos, state, 3);
    }

    if (stack.hasDisplayName())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            ((TileEntityChest)tileentity).setCustomName(stack.getDisplayName());
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:61,代码来源:BlockChest.java


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