use of net.minecraft.server.v1_16_R1.Chunk in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method spawnExistingEntity.
@Override
public void spawnExistingEntity(LivingEntity entity, SpawnReason spawnReason, boolean bypassSpawnEvent) {
Location location = entity.getLocation();
World world = location.getWorld();
if (world == null)
throw new IllegalArgumentException("Entity is not in a loaded world");
if (bypassSpawnEvent) {
IChunkAccess ichunkaccess = ((CraftWorld) world).getHandle().getChunkAt(MathHelper.floor(entity.getLocation().getX() / 16.0D), MathHelper.floor(entity.getLocation().getZ() / 16.0D), ChunkStatus.FULL, false);
if (!(ichunkaccess instanceof Chunk))
return;
ichunkaccess.a(((CraftEntity) entity).getHandle());
((CraftWorld) world).getHandle().addEntityChunk(((CraftEntity) entity).getHandle());
} else {
((CraftWorld) world).addEntity(((CraftEntity) entity).getHandle(), spawnReason);
}
}
use of net.minecraft.server.v1_16_R1.Chunk in project dynmap by webbukkit.
the class MapChunkCache116_3 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
if ((c != null) && c.loaded) {
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.server.v1_16_R1.Chunk in project dynmap by webbukkit.
the class MapChunkCache116 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
if ((c != null) && c.loaded) {
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.server.v1_16_R1.Chunk in project dynmap by webbukkit.
the class MapChunkCache115 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
if ((c != null) && c.loaded) {
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.server.v1_16_R1.Chunk in project dynmap by webbukkit.
the class MapChunkCache114_1 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
if ((c != null) && c.loaded) {
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
Aggregations