cn.nukkit.level.format.Chunk Java Examples
The following examples show how to use
cn.nukkit.level.format.Chunk.
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: Level.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public static Chunk.Entry getChunkXZ(long hash) { return new Chunk.Entry(getHashX(hash), getHashZ(hash)); }
Example #2
Source File: BlockEntityMobSpawner.java From Jupiter with GNU General Public License v3.0 | 4 votes |
@Override public boolean onUpdate() { if (this.closed) { return false; } this.timing.startTiming(); if (!(this.chunk instanceof Chunk)) { return false; } if (!(this.canUpdate())) { return false; } if (this.namedTag.getInt("Delay") <= 0) { int success = 0; NukkitRandom random = new NukkitRandom(); for (int i = 0; i < this.namedTag.getInt("SpawnCount"); ++i) { Vector3 pos = this.add( this.getRandomSpawn(), NukkitMath.randomRange(random, -1, 1), this.getRandomSpawn()); Block target = this.getLevel().getBlock(pos); Block ground = target.down(); if (target.getId() == Block.AIR && ground.isSolid()) { ++success; CompoundTag nbt = new CompoundTag() .putList(new ListTag<DoubleTag>("Pos") .add(new DoubleTag("", pos.x)) .add(new DoubleTag("", pos.y)) .add(new DoubleTag("", pos.z))) .putList(new ListTag<DoubleTag>("Motion") .add(new DoubleTag("", 0)) .add(new DoubleTag("", 0)) .add(new DoubleTag("", 0))) .putList(new ListTag<FloatTag>("Rotation") .add(new FloatTag("", (float) Math.random() * 360)) .add(new FloatTag("", (float) 0))); Entity entity = Entity.createEntity(this.getNetworkId(), this.chunk, nbt); entity.spawnToAll(); } } if (success > 0) { this.namedTag.putInt("Delay", NukkitMath.randomRange(random, this.namedTag.getInt("MinSpawnDelay"), this.namedTag.getInt("MaxSpawnDelay"))); } } else { this.namedTag.putInt("Delay", this.namedTag.getInt("Delay") - 1); } this.timing.stopTiming(); return true; }
Example #3
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public static Chunk.Entry getChunkXZ(long hash) { return new Chunk.Entry(getHashX(hash), getHashZ(hash)); }
Example #4
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public static Chunk.Entry getChunkXZ(long hash) { return new Chunk.Entry(getHashX(hash), getHashZ(hash)); }