• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BaseFullChunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: populate

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的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: populate

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的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:Rsplwe,项目名称:Nukkit-Java9,代码行数:24,代码来源:PopulatorLava.java


示例3: populate

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的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


示例4: close

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public void close() {
    if (this.getAutoSave()) {
        this.save();
    }

    for (BaseFullChunk chunk : new ArrayList<>(this.chunks.values())) {
        this.unloadChunk(chunk.getX(), chunk.getZ(), false);
    }

    this.unregisterGenerator();

    this.provider.close();
    this.provider = null;
    this.blockMetadata = null;
    this.blockCache.clear();
    this.temporalPosition = null;
    this.server.getLevels().remove(this.levelId);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:19,代码来源:Level.java


示例5: onCompletion

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void onCompletion(Server server) {
    Level level = server.getLevel(this.levelId);
    if (level != null) {
        if (!this.state) {
            level.registerGenerator();
            return;
        }

        BaseFullChunk chunk = this.chunk.clone();

        if (chunk == null) {
            return;
        }

        level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:19,代码来源:GenerationTask.java


示例6: setChunk

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void setChunk(int chunkX, int chunkZ, BaseFullChunk chunk) {
    if (chunk == null) {
        this.chunks.remove(Level.chunkHash(chunkX, chunkZ));
        return;
    }
    this.chunks.put(Level.chunkHash(chunkX, chunkZ), chunk);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:9,代码来源:SimpleChunkManager.java


示例7: onRun

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void onRun() {
    BaseFullChunk chunk = this.chunk.clone();
    if (chunk == null) {
        return;
    }

    chunk.recalculateHeightMap();
    chunk.populateSkyLight();
    chunk.setLightPopulated();

    this.chunk = chunk.clone();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:14,代码来源:LightPopulationTask.java


示例8: onCompletion

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void onCompletion(Server server) {
    Level level = server.getLevel(this.levelId);

    BaseFullChunk chunk = this.chunk.clone();
    if (level != null) {
        if (chunk == null) {
            return;
        }

        level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:14,代码来源:LightPopulationTask.java


示例9: PopulationTask

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public PopulationTask(Level level, BaseFullChunk chunk) {
    this.state = true;
    this.levelId = level.getId();
    this.chunk = chunk;

    for (int i = 0; i < 9; i++) {
        if (i == 4) {
            continue;
        }
        int xx = -1 + i % 3;
        int zz = -1 + (i / 3);
        BaseFullChunk ck = level.getChunk(chunk.getX() + xx, chunk.getZ() + zz, false);
        this.chunks[i] = ck;
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:16,代码来源:PopulationTask.java


示例10: onCompletion

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void onCompletion(Server server) {
    Level level = server.getLevel(this.levelId);
    if (level != null) {
        if (!this.state) {
            level.registerGenerator();
            return;
        }

        BaseFullChunk chunk = this.chunk.clone();

        if (chunk == null) {
            return;
        }

        for (int i = 0; i < 9; i++) {
            if (i == 4) {
                continue;
            }

            BaseFullChunk c = this.chunks[i];
            if (c != null) {
                c = c.clone();
                level.generateChunkCallback(c.getX(), c.getZ(), c);
            }
        }

        level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:31,代码来源:PopulationTask.java


示例11: populateChunk

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public boolean populateChunk(int x, int z, boolean force) {
    Long index = Level.chunkHash(x, z);
    if (this.chunkPopulationQueue.containsKey(index) || this.chunkPopulationQueue.size() >= this.chunkPopulationQueueSize && !force) {
        return false;
    }

    BaseFullChunk chunk = this.getChunk(x, z, true);
    boolean populate;
    if (!chunk.isPopulated()) {
        Timings.populationTimer.startTiming();
        populate = true;
        for (int xx = -1; xx <= 1; ++xx) {
            for (int zz = -1; zz <= 1; ++zz) {
                if (this.chunkPopulationLock.containsKey(Level.chunkHash(x + xx, z + zz))) {

                    populate = false;
                    break;
                }
            }
        }

        if (populate) {
            if (!this.chunkPopulationQueue.containsKey(index)) {
                this.chunkPopulationQueue.put(index, true);
                for (int xx = -1; xx <= 1; ++xx) {
                    for (int zz = -1; zz <= 1; ++zz) {
                        this.chunkPopulationLock.put(Level.chunkHash(x + xx, z + zz), true);
                    }
                }

                PopulationTask task = new PopulationTask(this, chunk);
                this.server.getScheduler().scheduleAsyncTask(task);
            }
        }
        Timings.populationTimer.stopTiming();
        return false;
    }

    return true;
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:41,代码来源:Level.java


示例12: onRun

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
@Override
public void onRun() {
    Generator generator = GeneratorPool.get(this.levelId);

    if (generator == null) {
        this.state = false;
        return;
    }

    SimpleChunkManager manager = (SimpleChunkManager) generator.getChunkManager();

    if (manager == null) {
        this.state = false;
        return;
    }

    synchronized (manager) {
        BaseFullChunk chunk = this.chunk.clone();

        if (chunk == null) {
            return;
        }

        manager.setChunk(chunk.getX(), chunk.getZ(), chunk);

        generator.generateChunk(chunk.getX(), chunk.getZ());

        chunk = manager.getChunk(chunk.getX(), chunk.getZ());
        chunk.setGenerated();
        this.chunk = chunk.clone();

        manager.setChunk(chunk.getX(), chunk.getZ(), null);
    }

}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:36,代码来源:GenerationTask.java


示例13: getBlock

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public Block getBlock(Vector3 pos, boolean cached) {
    long chunkIndex = Level.chunkHash((int) pos.x >> 4, (int) pos.z >> 4);
    BlockVector3 index = Level.blockHash((int) pos.x, (int) pos.y, (int) pos.z);
    int fullState;

    Block block;
    BaseFullChunk chunk;

    if (cached && (block = (Block) this.blockCache.get(index)) != null) {
        return block;
    } else if (pos.y >= 0 && pos.y < 256 && (chunk = this.chunks.get(chunkIndex)) != null) {
        fullState = chunk.getFullBlock((int) pos.x & 0x0f, (int) pos.y & 0xff,
                (int) pos.z & 0x0f);
    } else {
        fullState = 0;
    }

    block = this.blockStates[fullState & 0xfff].clone();

    block.x = pos.x;
    block.y = pos.y;
    block.z = pos.z;
    block.level = this;

    this.blockCache.put(index, block);

    return block;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:29,代码来源:Level.java


示例14: getChunk

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public BaseFullChunk getChunk(int chunkX, int chunkZ, boolean create) {
    Long index = Level.chunkHash(chunkX, chunkZ);
    if (this.chunks.containsKey(index)) {
        return this.chunks.get(index);
    } else if (this.loadChunk(chunkX, chunkZ, create)) {
        return this.chunks.get(index);
    }

    return null;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:11,代码来源:Level.java


示例15: generateChunkCallback

import cn.nukkit.level.format.generic.BaseFullChunk; //导入依赖的package包/类
public void generateChunkCallback(int x, int z, BaseFullChunk chunk) {
    Timings.generationCallbackTimer.startTiming();
    Long index = Level.chunkHash(x, z);
    if (this.chunkPopulationQueue.containsKey(index)) {
        FullChunk oldChunk = this.getChunk(x, z, false);
        for (int xx = -1; xx <= 1; ++xx) {
            for (int zz = -1; zz <= 1; ++zz) {
                this.chunkPopulationLock.remove(Level.chunkHash(x + xx, z + zz));
            }
        }
        this.chunkPopulationQueue.remove(index);
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
        chunk = this.getChunk(x, z, false);
        if (chunk != null && (oldChunk == null || !oldChunk.isPopulated()) && chunk.isPopulated()
                && chunk.getProvider() != null) {
            this.server.getPluginManager().callEvent(new ChunkPopulateEvent(chunk));

            for (ChunkLoader loader : this.getChunkLoaders(x, z)) {
                loader.onChunkPopulated(chunk);
            }
        }
    } else if (this.chunkGenerationQueue.containsKey(index) || this.chunkPopulationLock.containsKey(index)) {
        this.chunkGenerationQueue.remove(index);
        this.chunkPopulationLock.remove(index);
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
    } else {
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
    }
    Timings.generationCallbackTimer.stopTiming();
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:34,代码来源:Level.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Fish类代码示例发布时间:2022-05-21
下一篇:
Java XmlUtil类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap