Java Code Examples for cn.nukkit.level.format.FullChunk#getProvider()
The following examples show how to use
cn.nukkit.level.format.FullChunk#getProvider() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockEntity.java From Jupiter with GNU General Public License v3.0 | 6 votes |
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); }
Example 2
Source File: BlockEntity.java From Nukkit with GNU General Public License v3.0 | 6 votes |
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.initBlockEntity(); this.chunk.addBlockEntity(this); this.getLevel().addBlockEntity(this); }
Example 3
Source File: BlockEntity.java From Nukkit with GNU General Public License v3.0 | 6 votes |
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.initBlockEntity(); this.chunk.addBlockEntity(this); this.getLevel().addBlockEntity(this); }
Example 4
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 4 votes |
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(); }
Example 5
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 4 votes |
protected final void init(FullChunk chunk, CompoundTag nbt) { if ((chunk == null || chunk.getProvider() == null)) { throw new ChunkException("Invalid garbage Chunk given to Entity"); } if (this.initialized) { // We've already initialized this entity return; } this.initialized = true; 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 SimpleAxisAlignedBB(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(); }
Example 6
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 4 votes |
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 SimpleAxisAlignedBB(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(); }