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


Java FullChunk类代码示例

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


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

示例1: setChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
@Override
public void setChunk(int chunkX, int chunkZ, FullChunk chunk) {
    if (!(chunk instanceof Chunk)) {
        throw new ChunkException("Invalid Chunk class");
    }
    chunk.setProvider(this);
    int regionX = chunkX >> 5;
    int regionZ = chunkZ >> 5;
    this.loadRegion(regionX, regionZ);
    chunk.setX(chunkX);
    chunk.setZ(chunkZ);
    long index = Level.chunkHash(chunkX, chunkZ);
    if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) {
        this.unloadChunk(chunkX, chunkZ, false);
    }
    this.chunks.put(index, (Chunk) chunk);
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:18,代码来源:McRegion.java

示例2: generateChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
protected void generateChunk(int chunkX, int chunkZ, FullChunk generatingChunkBuffer) {
    if (this.random.nextInt(300) >= this.ravineRarity)
        return;
    double d1 = (chunkX * 16) + this.random.nextInt(16);
    double d2 = numberInRange(random, this.ravineMinAltitude, this.ravineMaxAltitude);
    double d3 = (chunkZ * 16) + this.random.nextInt(16);

    int i = 1;

    for (int j = 0; j < i; j++) {
        float f1 = this.random.nextFloat() * 3.141593F * 2.0F;
        float f2 = (this.random.nextFloat() - 0.5F) * 2.0F / 8.0F;
        float f3 = (this.random.nextFloat() * 2.0F + this.random.nextFloat()) * 2.0F;

        int size = numberInRange(random, this.ravineMinLength, this.ravineMaxLength);

        createRavine(this.random.nextLong(), generatingChunkBuffer, d1, d2, d3, f3, f1, f2, size, this.ravineDepth);
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:20,代码来源:PopulatorRavines.java

示例3: BlockEntityChest

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntityChest(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);
    this.inventory = new ChestInventory(this);

    if (!this.namedTag.contains("Items") || !(this.namedTag.get("Items") instanceof ListTag)) {
        this.namedTag.putList(new ListTag<CompoundTag>("Items"));
    }

    /* for (int i = 0; i < this.getSize(); i++) {
        this.inventory.setItem(i, this.getItem(i));
    } */
    
    ListTag<CompoundTag> list = (ListTag<CompoundTag>) this.namedTag.getList("Items");
    for (CompoundTag compound : list.getAll()) {
        Item item = NBTIO.getItemHelper(compound);
        this.inventory.slots.put(compound.getByte("Slot"), item);
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:19,代码来源:BlockEntityChest.java

示例4: BlockEntity

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntity(FullChunk chunk, CompoundTag nbt) {
    if (chunk == null || chunk.getProvider() == null) {
        throw new ChunkException("Invalid garbage Chunk given to Block Entity");
    }

    this.timing = Timings.getBlockEntityTiming(this);
    this.server = chunk.getProvider().getLevel().getServer();
    this.chunk = chunk;
    this.setLevel(chunk.getProvider().getLevel());
    this.namedTag = nbt;
    this.name = "";
    this.lastUpdate = System.currentTimeMillis();
    this.id = BlockEntity.count++;
    this.x = this.namedTag.getInt("x");
    this.y = this.namedTag.getInt("y");
    this.z = this.namedTag.getInt("z");
    this.movable = this.namedTag.getBoolean("isMovable");

    this.chunk.addBlockEntity(this);
    this.getLevel().addBlockEntity(this);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:22,代码来源:BlockEntity.java

示例5: BlockEntityHopper

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntityHopper(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);

    if (this.namedTag.contains("TransferCooldown")) {
        this.transferCooldown = this.namedTag.getInt("TransferCooldown");
    }

    this.inventory = new HopperInventory(this);

    if (!this.namedTag.contains("Items") || !(this.namedTag.get("Items") instanceof ListTag)) {
        this.namedTag.putList(new ListTag<CompoundTag>("Items"));
    }

    for (int i = 0; i < this.getSize(); i++) {
        this.inventory.setItem(i, this.getItem(i));
    }

    this.pickupArea = new AxisAlignedBB(this.x, this.y, this.z, this.x + 1, this.y + 2, this.z + 1);

    this.scheduleUpdate();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:22,代码来源:BlockEntityHopper.java

示例6: generateChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
private void generateChunk(FullChunk chunk) {
    chunk.setGenerated();
    int c = Biome.getBiome(biome).getColor();
    int R = c >> 16;
    int G = (c >> 8) & 0xff;
    int B = c & 0xff;

    for (int Z = 0; Z < 16; ++Z) {
        for (int X = 0; X < 16; ++X) {
            chunk.setBiomeId(X, Z, biome);
            chunk.setBiomeColor(X, Z, R, G, B);
            for (int y = 0; y < 256; ++y) {
                int k = this.structure[y][0];
                int l = this.structure[y][1];
                chunk.setBlock(X, y, Z, this.structure[y][0], this.structure[y][1]);
            }
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:20,代码来源:Flat.java

示例7: BlockEntity

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntity(FullChunk chunk, CompoundTag nbt) {
    if (chunk == null || chunk.getProvider() == null) {
        throw new ChunkException("Invalid garbage Chunk given to Block Entity");
    }

    this.timing = Timings.getBlockEntityTiming(this);
    this.server = chunk.getProvider().getLevel().getServer();
    this.chunk = chunk;
    this.setLevel(chunk.getProvider().getLevel());
    this.namedTag = nbt;
    this.name = "";
    this.lastUpdate = System.currentTimeMillis();
    this.id = BlockEntity.count++;
    this.x = this.namedTag.getInt("x");
    this.y = this.namedTag.getInt("y");
    this.z = this.namedTag.getInt("z");

    this.chunk.addBlockEntity(this);
    this.getLevel().addBlockEntity(this);
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:21,代码来源:BlockEntity.java

示例8: BlockEntityBrewingStand

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntityBrewingStand(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);
    inventory = new BrewingInventory(this);

    if (!namedTag.contains("Items") || !(namedTag.get("Items") instanceof ListTag)) {
        namedTag.putList(new ListTag<CompoundTag>("Items"));
    }

    for (int i = 0; i < getSize(); i++) {
        inventory.setItem(i, this.getItem(i));
    }

    if (!namedTag.contains("CookTime") || namedTag.getShort("CookTime") > MAX_BREW_TIME) {
        this.brewTime = MAX_BREW_TIME;
    } else {
        this.brewTime = namedTag.getShort("CookTime");
    }

    if (brewTime < MAX_BREW_TIME) {
        this.scheduleUpdate();
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:23,代码来源:BlockEntityBrewingStand.java

示例9: setChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
@Override
public void setChunk(int chunkX, int chunkZ, FullChunk chunk) {
    if (!(chunk instanceof Chunk)) {
        throw new ChunkException("Invalid Chunk class");
    }
    chunk.setProvider(this);

    chunk.setX(chunkX);
    chunk.setZ(chunkZ);
    long index = Level.chunkHash(chunkX, chunkZ);

    if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) {
        this.unloadChunk(chunkX, chunkZ, false);
    }

    this.chunks.put(index, (Chunk) chunk);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:18,代码来源:LevelDB.java

示例10: Entity

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public Entity(FullChunk chunk, CompoundTag nbt) {
    if (this instanceof Player) {
        return;
    }

    this.init(chunk, nbt);
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:8,代码来源:Entity.java

示例11: saveChunks

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public void saveChunks() {
    for (FullChunk chunk : new ArrayList<>(this.chunks.values())) {
        if (chunk.hasChanged()) {
            try {
                this.provider.setChunk(chunk.getX(), chunk.getZ(), chunk);
                this.provider.saveChunk(chunk.getX(), chunk.getZ());

                chunk.setChanged(false);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:15,代码来源:Level.java

示例12: to

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public ChunkConverter to(Class<? extends FullChunk> toClass) {
    if (toClass != Chunk.class) {
        throw new IllegalArgumentException("To type can be only Anvil");
    }
    this.toClass = toClass;
    return this;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:8,代码来源:ChunkConverter.java

示例13: BlockEntityFurnace

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
public BlockEntityFurnace(FullChunk chunk, CompoundTag nbt) {
    super(chunk, nbt);
    this.inventory = new FurnaceInventory(this);

    if (!this.namedTag.contains("Items") || !(this.namedTag.get("Items") instanceof ListTag)) {
        this.namedTag.putList(new ListTag<CompoundTag>("Items"));
    }

    for (int i = 0; i < this.getSize(); i++) {
        this.inventory.setItem(i, this.getItem(i));
    }

    if (!this.namedTag.contains("BurnTime") || this.namedTag.getShort("BurnTime") < 0) {
        burnTime = 0;
    } else {
        burnTime = this.namedTag.getShort("BurnTime");
    }

    if (!this.namedTag.contains("CookTime") || this.namedTag.getShort("CookTime") < 0 || (this.namedTag.getShort("BurnTime") == 0 && this.namedTag.getShort("CookTime") > 0)) {
        cookTime = 0;
    } else {
        cookTime = this.namedTag.getShort("CookTime");
    }

    if (!this.namedTag.contains("MaxTime")) {
        maxTime = burnTime;
        burnDuration = 0;
    } else {
        maxTime = this.namedTag.getShort("MaxTime");
    }

    if (this.namedTag.contains("BurnTicks")) {
        burnDuration = this.namedTag.getShort("BurnTicks");
        this.namedTag.remove("BurnTicks");
    }

    if (burnTime > 0) {
        this.scheduleUpdate();
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:41,代码来源:BlockEntityFurnace.java

示例14: setChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
@Override
public void setChunk(int chunkX, int chunkZ, FullChunk chunk) {
    if (!(chunk instanceof Chunk)) {
        throw new ChunkException("Invalid Chunk class");
    }
    chunk.setProvider(this);
    int regionX = chunkX >> 5;
    int regionZ = chunkZ >> 5;
    this.loadRegion(regionX, regionZ);

    chunk.setX(chunkX);
    chunk.setZ(chunkZ);
    long index = Level.chunkHash(chunkX, chunkZ);
    this.chunks.put(index, (Chunk) chunk);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:16,代码来源:Anvil.java

示例15: saveChunk

import cn.nukkit.level.format.FullChunk; //导入依赖的package包/类
@Override
public void saveChunk(int x, int z, FullChunk chunk) {
    if (!(chunk instanceof Chunk)) {
        throw new ChunkException("Invalid Chunk class");
    }
    this.writeChunk((Chunk) chunk);
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:8,代码来源:LevelDB.java


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