本文整理汇总了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);
}
示例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);
}
示例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();
}