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


Java FullChunk.getProvider方法代码示例

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


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

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

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

示例3: init

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

    this.timing = Timings.getEntityTiming(this);

    this.isPlayer = this instanceof Player;
    this.temporalVector = new Vector3();

    this.id = Entity.entityCount++;
    this.justCreated = true;
    this.namedTag = nbt;

    this.chunk = chunk;
    this.setLevel(chunk.getProvider().getLevel());
    this.server = chunk.getProvider().getLevel().getServer();

    this.boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);

    ListTag<DoubleTag> posList = this.namedTag.getList("Pos", DoubleTag.class);
    ListTag<FloatTag> rotationList = this.namedTag.getList("Rotation", FloatTag.class);
    ListTag<DoubleTag> motionList = this.namedTag.getList("Motion", DoubleTag.class);
    this.setPositionAndRotation(
            this.temporalVector.setComponents(
                    posList.get(0).data,
                    posList.get(1).data,
                    posList.get(2).data
            ),
            rotationList.get(0).data,
            rotationList.get(1).data
    );

    this.setMotion(this.temporalVector.setComponents(
            motionList.get(0).data,
            motionList.get(1).data,
            motionList.get(2).data
    ));

    if (!this.namedTag.contains("FallDistance")) {
        this.namedTag.putFloat("FallDistance", 0);
    }
    this.fallDistance = this.namedTag.getFloat("FallDistance");
    this.highestPosition = this.y + this.namedTag.getFloat("FallDistance");

    if (!this.namedTag.contains("Fire") || this.namedTag.getShort("Fire") > 32767) {
        this.namedTag.putShort("Fire", 0);
    }
    this.fireTicks = this.namedTag.getShort("Fire");

    if (!this.namedTag.contains("Air")) {
        this.namedTag.putShort("Air", 300);
    }
    this.setDataProperty(new ShortEntityData(DATA_AIR, this.namedTag.getShort("Air")), false);

    if (!this.namedTag.contains("OnGround")) {
        this.namedTag.putBoolean("OnGround", false);
    }
    this.onGround = this.namedTag.getBoolean("OnGround");

    if (!this.namedTag.contains("Invulnerable")) {
        this.namedTag.putBoolean("Invulnerable", false);
    }
    this.invulnerable = this.namedTag.getBoolean("Invulnerable");

    if (!this.namedTag.contains("Scale")) {
        this.namedTag.putFloat("Scale", 1);
    }
    this.scale = this.namedTag.getFloat("Scale");
    this.setDataProperty(new FloatEntityData(DATA_SCALE, scale), false);

    this.chunk.addEntity(this);
    this.level.addEntity(this);

    this.initEntity();

    this.lastUpdate = this.server.getTick();
    this.server.getPluginManager().callEvent(new EntitySpawnEvent(this));

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


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