當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。