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


Java ChunkManager类代码示例

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


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

示例1: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    int bx = chunkX << 4;
    int bz = chunkZ << 4;
    int tx = bx + 15;
    int tz = bz + 15;
    ObjectOre ore = new ObjectOre(random, type, Block.AIR);
    for (int i = 0; i < ore.type.clusterCount; ++i) {
        int x = random.nextRange(0, 15);
        int z = random.nextRange(0, 15);
        int y = this.getHighestWorkableBlock(chunk, x, z);
        if (y != -1) {
            ore.placeObject(level, bx + x, y, bz + z);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:19,代码来源:PopulatorGlowStone.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:CoreXDevelopment,项目名称:CoreX,代码行数:24,代码来源:ObjectTree.java

示例3: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }
        new NewJungleTree(4 + random.nextBoundedInt(7)).generate(level, random, v.setComponents(x, y, z));
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:17,代码来源:JungleTreePopulator.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: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }
        new ObjectJungleBigTree(10, 20, new BlockWood(BlockWood.JUNGLE), new BlockLeaves(BlockLeaves.JUNGLE)).generate(this.level, random, v.setComponents(x, y, z));
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:17,代码来源:JungleBigTreePopulator.java

示例6: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.random = new Random();
    this.random.setSeed(level.getSeed());
    long worldLong1 = this.random.nextLong();
    long worldLong2 = this.random.nextLong();

    int size = this.checkAreaSize;

    for (int x = chunkX - size; x <= chunkX + size; x++)
        for (int z = chunkZ - size; z <= chunkZ + size; z++) {
            long randomX = x * worldLong1;
            long randomZ = z * worldLong2;
            this.random.setSeed(randomX ^ randomZ ^ level.getSeed());
            generateChunk(x, z, level.getChunk(chunkX, chunkZ));
        }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:18,代码来源:PopulatorCaves.java

示例7: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    int bx = chunkX << 4;
    int bz = chunkZ << 4;
    int tx = bx + 15;
    int tz = bz + 15;
    int amount = random.nextRange(0, this.randomAmount + 1) + this.baseAmount;
    for (int i = 0; i < amount; ++i) {
        int x = random.nextRange(0, 15);
        int z = random.nextRange(0, 15);
        int y = this.getHighestWorkableBlock(chunk, x, z);
        if (y != -1 && this.canGroundFireStay(chunk, x, y, z)) {
            chunk.setBlock(x, y, z, Block.FIRE);
            chunk.setBlockLight(x, y, z, Block.light[Block.FIRE]);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:20,代码来源:PopulatorGroundFire.java

示例8: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;

    if (flowerTypes.size() == 0) {
        this.addType(Block.RED_FLOWER, BlockFlower.TYPE_POPPY);
        this.addType(Block.DANDELION, 0);
    }

    int endNum = this.flowerTypes.size();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX * 16, chunkX * 16 + 15);
        int z = NukkitMath.randomRange(random, chunkZ * 16, chunkZ * 16 + 15);
        int y = this.getHighestWorkableBlock(x, z);


        if (y != -1 && this.canFlowerStay(x, y, z)) {
            int[] type = this.flowerTypes.get(random.nextRange(0, endNum - 1));
            this.level.setBlockIdAt(x, y, z, type[0]);
            this.level.setBlockDataAt(x, y, z, type[1]);
        }
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:26,代码来源:PopulatorFlower.java

示例9: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.random = new Random();
    this.random.setSeed(level.getSeed());
    worldLong1 = this.random.nextLong();
    worldLong2 = this.random.nextLong();

    int i = this.checkAreaSize;

    for (int x = chunkX - i; x <= chunkX + i; x++)
        for (int z = chunkZ - i; z <= chunkZ + i; z++) {
            long l3 = x * worldLong1;
            long l4 = z * worldLong2;
            this.random.setSeed(l3 ^ l4 ^ level.getSeed());
            generateChunk(chunkX, chunkZ, level.getChunk(chunkX, chunkZ));
        }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:18,代码来源:PopulatorRavines.java

示例10: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }
        new NewSavannaTree().generate(level, random, v.setComponents(x, y, z));
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:17,代码来源:SavannaTreePopulator.java

示例11: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.random = random;
    if (random.nextRange(0, 100) < 5) {
        this.level = level;
        int amount = random.nextRange(0, this.randomAmount + 1) + this.baseAmount;
        BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
        int bx = chunkX << 4;
        int bz = chunkZ << 4;
        int tx = bx + 15;
        int tz = bz + 15;
        for (int i = 0; i < amount; ++i) {
            int x = random.nextRange(0, 15);
            int z = random.nextRange(0, 15);
            int y = this.getHighestWorkableBlock(chunk, x, z);
            if (y != -1 && chunk.getBlockId(x, y, z) == Block.AIR) {
                chunk.setBlock(x, y, z, Block.LAVA);
                chunk.setBlockLight(x, y, z, Block.light[Block.LAVA]);
                this.lavaSpread(bx + x, y, bz + z);
            }
        }
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:24,代码来源:PopulatorLava.java

示例12: 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

示例13: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }
        new ObjectSwampTree().generate(level, random, v.setComponents(x, y, z));
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:17,代码来源:SwampTreePopulator.java

示例14: populate

import cn.nukkit.level.ChunkManager; //导入依赖的package包/类
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    int amount = random.nextBoundedInt(this.randomAmount + 1) + this.baseAmount;
    Vector3 v = new Vector3();

    for (int i = 0; i < amount; ++i) {
        int x = NukkitMath.randomRange(random, chunkX << 4, (chunkX << 4) + 15);
        int z = NukkitMath.randomRange(random, chunkZ << 4, (chunkZ << 4) + 15);
        int y = this.getHighestWorkableBlock(x, z);
        if (y == -1) {
            continue;
        }

        new ObjectDarkOakTree().generate(level, random, v.setComponents(x, y, z));
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:18,代码来源:DarkOakTreePopulator.java

示例15: 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:Rsplwe,项目名称:Nukkit-Java9,代码行数:22,代码来源:ObjectTallGrass.java


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