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


Java ChunkManager.getBlockIdAt方法代码示例

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


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

示例1: growLeavesLayerStrict

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
/**
 * grow leaves in a circle with the outsides being within the circle
 */
protected void growLeavesLayerStrict(ChunkManager worldIn, Vector3 layerCenter, int width) {
    int i = width * width;

    for (int j = -width; j <= width + 1; ++j) {
        for (int k = -width; k <= width + 1; ++k) {
            int l = j - 1;
            int i1 = k - 1;

            if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) {
                Vector3 blockpos = layerCenter.add(j, 0, k);
                int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

                if (id == Block.AIR || id == Block.LEAVES) {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:23,代码来源:HugeTreesGenerator.java

示例2: placeObject

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
public void placeObject(ChunkManager level, int x, int y, int z, NukkitRandom random) {

        this.placeTrunk(level, x, y, z, random, this.getTreeHeight() - 1);

        for (int yy = y - 3 + this.getTreeHeight(); yy <= y + this.getTreeHeight(); ++yy) {
            double yOff = yy - (y + this.getTreeHeight());
            int mid = (int) (1 - yOff / 2);
            for (int xx = x - mid; xx <= x + mid; ++xx) {
                int xOff = Math.abs(xx - x);
                for (int zz = z - mid; zz <= z + mid; ++zz) {
                    int zOff = Math.abs(zz - z);
                    if (xOff == mid && zOff == mid && (yOff == 0 || random.nextBoundedInt(2) == 0)) {
                        continue;
                    }
                    if (!Block.solid[level.getBlockIdAt(xx, yy, zz)]) {

                        level.setBlockIdAt(xx, yy, zz, this.getLeafBlock());
                        level.setBlockDataAt(xx, yy, zz, this.getType());
                    }
                }
            }
        }
    }
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:24,代码来源:ObjectTree.java

示例3: growGrass

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
public static void growGrass(ChunkManager level, Vector3 pos, NukkitRandom random, int count, int radius) {
    int[][] arr = {
            {Block.DANDELION, 0},
            {Block.POPPY, 0},
            {Block.TALL_GRASS, 1},
            {Block.TALL_GRASS, 1},
            {Block.TALL_GRASS, 1},
            {Block.TALL_GRASS, 1}
    };
    int arrC = arr.length - 1;
    for (int c = 0; c < count; c++) {
        int x = random.nextRange((int) (pos.x - radius), (int) (pos.x + radius));
        int z = random.nextRange((int) (pos.z) - radius, (int) (pos.z + radius));

        if (level.getBlockIdAt(x, (int) (pos.y + 1), z) == Block.AIR && level.getBlockIdAt(x, (int) (pos.y), z) == Block.GRASS) {
            int[] t = arr[random.nextRange(0, arrC)];
            level.setBlockIdAt(x, (int) (pos.y + 1), z, t[0]);
            level.setBlockDataAt(x, (int) (pos.y + 1), z, t[1]);
        }
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:22,代码来源:ObjectTallGrass.java

示例4: growLeavesLayer

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
/**
 * grow leaves in a circle
 */
protected void growLeavesLayer(ChunkManager worldIn, Vector3 layerCenter, int width) {
    int i = width * width;

    for (int j = -width; j <= width; ++j) {
        for (int k = -width; k <= width; ++k) {
            if (j * j + k * k <= i) {
                Vector3 blockpos = layerCenter.add(j, 0, k);
                int id = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

                if (id == Block.AIR || id == Block.LEAVES) {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                }
            }
        }
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:20,代码来源:HugeTreesGenerator.java

示例5: addHangingVine

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
private void addHangingVine(ChunkManager worldIn, BlockVector3 pos, int meta) {
    this.addVine(worldIn, pos, meta);
    int i = 4;

    for (pos = pos.down(); i > 0 && worldIn.getBlockIdAt(pos.x, pos.y, pos.z) == Block.AIR; --i) {
        this.addVine(worldIn, pos, meta);
        pos = pos.down();
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:10,代码来源:NewJungleTree.java

示例6: ensureDirtsUnderneath

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
/**
 * returns whether or not there is dirt underneath the block where the tree will be grown.
 * It also generates dirt around the block in a 2x2 square if there is dirt underneath the blockpos.
 */
private boolean ensureDirtsUnderneath(Vector3 pos, ChunkManager worldIn) {
    Vector3 blockpos = pos.down();
    int block = worldIn.getBlockIdAt((int) blockpos.x, (int) blockpos.y, (int) blockpos.z);

    if ((block == Block.GRASS || block == Block.DIRT) && pos.getY() >= 2) {
        this.setDirtAt(worldIn, blockpos);
        this.setDirtAt(worldIn, blockpos.east());
        this.setDirtAt(worldIn, blockpos.south());
        this.setDirtAt(worldIn, blockpos.south().east());
        return true;
    } else {
        return false;
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:19,代码来源:HugeTreesGenerator.java

示例7: placeLeafAt

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
private void placeLeafAt(ChunkManager worldIn, int x, int y, int z) {
    Vector3 blockpos = new Vector3(x, y, z);
    int material = worldIn.getBlockIdAt(blockpos.getFloorX(), blockpos.getFloorY(), blockpos.getFloorZ());

    if (material == Block.AIR) {
        this.setBlockAndNotifyAdequately(worldIn, blockpos, DARK_OAK_LEAVES);
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:9,代码来源:ObjectDarkOakTree.java

示例8: placeLeafAt

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
private void placeLeafAt(ChunkManager worldIn, Vector3 pos) {
    int material = worldIn.getBlockIdAt(pos.getFloorX(), pos.getFloorY(), pos.getFloorZ());

    if (material == Block.AIR || material == Block.LEAVES) {
        this.setBlockAndNotifyAdequately(worldIn, pos, LEAF);
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:8,代码来源:NewSavannaTree.java

示例9: placeTrunk

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
protected void placeTrunk(ChunkManager level, int x, int y, int z, NukkitRandom random, int trunkHeight) {
    // The base dirt block
    level.setBlockIdAt(x, y - 1, z, Block.DIRT);

    for (int yy = 0; yy < trunkHeight; ++yy) {
        int blockId = level.getBlockIdAt(x, y + yy, z);
        if (this.overridable.containsKey(blockId)) {
            level.setBlockIdAt(x, y + yy, z, this.getTrunkBlock());
            level.setBlockDataAt(x, y + yy, z, this.getType());
        }
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:13,代码来源:ObjectTree.java

示例10: setDirtAt

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
/**
 * sets dirt at a specific location if it isn't already dirt
 */
protected void setDirtAt(ChunkManager level, Vector3 pos) {
    if (level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) != Item.DIRT) {
        this.setBlockAndNotifyAdequately(level, pos, new BlockDirt());
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:9,代码来源:TreeGenerator.java

示例11: canPlaceObject

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
public boolean canPlaceObject(ChunkManager level, int x, int y, int z) {
    return (level.getBlockIdAt(x, y, z) == replaceId);
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:4,代码来源:ObjectOre.java

示例12: placeVine

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
private void placeVine(ChunkManager level, NukkitRandom random, Vector3 pos, int meta) {
    if (random.nextBoundedInt(3) > 0 && level.getBlockIdAt((int) pos.x, (int) pos.y, (int) pos.z) == 0) {
        this.setBlockAndNotifyAdequately(level, pos, new BlockVine(meta));
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:6,代码来源:ObjectJungleBigTree.java

示例13: isAirBlock

import cn.nukkit.level.ChunkManager; //导入方法依赖的package包/类
private boolean isAirBlock(ChunkManager level, BlockVector3 v) {
    return level.getBlockIdAt(v.x, v.y, v.z) == 0;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:4,代码来源:NewJungleTree.java


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