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


Java LevelException类代码示例

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


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

示例1: BaseLevelProvider

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public BaseLevelProvider(Level level, String path) throws IOException {
    this.level = level;
    this.path = path;
    File file_path = new File(this.path);
    if (!file_path.exists()) {
        file_path.mkdirs();
    }
    CompoundTag levelData = NBTIO.readCompressed(new FileInputStream(new File(this.getPath() + "level.dat")), ByteOrder.BIG_ENDIAN);
    if (levelData.get("Data") instanceof CompoundTag) {
        this.levelData = levelData.getCompound("Data");
    } else {
        throw new LevelException("Invalid level.dat");
    }

    if (!this.levelData.contains("generatorName")) {
        this.levelData.putString("generatorName", Generator.getGenerator("DEFAULT").getSimpleName().toLowerCase());
    }

    if (!this.levelData.contains("generatorOptions")) {
        this.levelData.putString("generatorOptions", "");
    }

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

示例2: removeEntity

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public void removeEntity(Entity entity) {
    if (entity.getLevel() != this) {
        throw new LevelException("Invalid Entity level");
    }

    if (entity instanceof Player) {
        this.players.remove(entity.getId());
        this.checkSleep();
    } else {
        entity.close();
    }

    this.entities.remove(entity.getId());
    this.updateEntities.remove(entity.getId());
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:16,代码来源:Level.java

示例3: addEntity

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public void addEntity(Entity entity) {
    if (entity.getLevel() != this) {
        throw new LevelException("Invalid Entity level");
    }

    if (entity instanceof Player) {
        this.players.put(entity.getId(), (Player) entity);
    }
    this.entities.put(entity.getId(), entity);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:11,代码来源:Level.java

示例4: addBlockEntity

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public void addBlockEntity(BlockEntity blockEntity) {
    if (blockEntity.getLevel() != this) {
        throw new LevelException("Invalid Block Entity level");
    }
    blockEntities.put(blockEntity.getId(), blockEntity);
    this.clearChunkCache((int) blockEntity.getX() >> 4, (int) blockEntity.getZ() >> 4);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:8,代码来源:Level.java

示例5: removeBlockEntity

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public void removeBlockEntity(BlockEntity blockEntity) {
    if (blockEntity.getLevel() != this) {
        throw new LevelException("Invalid Block Entity level");
    }
    blockEntities.remove(blockEntity.getId());
    updateBlockEntities.remove(blockEntity.getId());
    this.clearChunkCache((int) blockEntity.getX() >> 4, (int) blockEntity.getZ() >> 4);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:9,代码来源:Level.java

示例6: getSide

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public Position getSide(BlockFace face, int step) {
    if (!this.isValid()) {
        throw new LevelException("Undefined Level reference");
    }
    return Position.fromObject(super.getSide(face, step), this.level);
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:7,代码来源:Position.java

示例7: getLevelBlock

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public Block getLevelBlock() {
    if (this.isValid()) return this.level.getBlock(this);
    else throw new LevelException("Undefined Level reference");
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:Position.java

示例8: getLocation

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public Location getLocation() {
    if (this.isValid()) return new Location(this.x, this.y, this.z, 0, 0, this.level);
    else throw new LevelException("Undefined Level reference");
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:5,代码来源:Position.java

示例9: getLocation

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
@Override
public Location getLocation() {
    if (this.isValid()) return new Location(this.x, this.y, this.z, this.yaw, this.pitch, this.level);
    else throw new LevelException("Undefined Level reference");
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:6,代码来源:Location.java

示例10: recalculateBoundingBox

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
protected AxisAlignedBB recalculateBoundingBox() {
    double f = 0.4375;
    double f1 = 0.5625;
    double f2 = 0.4375;
    double f3 = 0.5625;
    try {
        boolean flag = this.canConnect(this.north());
        boolean flag1 = this.canConnect(this.south());
        boolean flag2 = this.canConnect(this.west());
        boolean flag3 = this.canConnect(this.east());
        if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) {
            if (flag2) {
                f = 0;
            } else if (flag3) {
                f1 = 1;
            }
        } else {
            f = 0;
            f1 = 1;
        }
        if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) {
            if (flag) {
                f2 = 0;
            } else if (flag1) {
                f3 = 1;
            }
        } else {
            f2 = 0;
            f3 = 1;
        }
    } catch (LevelException ignore) {
        //null sucks
    }
    return new AxisAlignedBB(
            this.x + f,
            this.y,
            this.z + f2,
            this.x + f1,
            this.y + 1,
            this.z + f3
    );
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:43,代码来源:BlockThin.java

示例11: getSide

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
public Position getSide(int side, int step) {
    if (!this.isValid()) {
        throw new LevelException("Undefined Level reference");
    }
    return Position.fromObject(super.getSide(side, step), this.level);
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:7,代码来源:Position.java

示例12: recalculateBoundingBox

import cn.nukkit.utils.LevelException; //导入依赖的package包/类
protected AxisAlignedBB recalculateBoundingBox() {
    double f = 0.4375;
    double f1 = 0.5625;
    double f2 = 0.4375;
    double f3 = 0.5625;
    try {
        boolean flag = this.canConnect(this.getSide(2));
        boolean flag1 = this.canConnect(this.getSide(3));
        boolean flag2 = this.canConnect(this.getSide(4));
        boolean flag3 = this.canConnect(this.getSide(5));
        if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) {
            if (flag2) {
                f = 0;
            } else if (flag3) {
                f1 = 1;
            }
        } else {
            f = 0;
            f1 = 1;
        }
        if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) {
            if (flag) {
                f2 = 0;
            } else if (flag1) {
                f3 = 1;
            }
        } else {
            f2 = 0;
            f3 = 1;
        }
    } catch (LevelException ignore) {
        //null sucks
    }
    return new AxisAlignedBB(
            this.x + f,
            this.y,
            this.z + f2,
            this.x + f1,
            this.y + 1,
            this.z + f3
    );
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:43,代码来源:BlockThin.java


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