use of net.minecraft.server.v1_8_R2.WorldServer in project DragonsOnline by UniverseCraft.
the class PlayerNPC116R3 method spawn.
public void spawn() {
registry.unregister(this);
uuid = UUID.randomUUID();
this.isDestroyed = false;
DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer();
WorldServer world = ((CraftWorld) location.getWorld()).getHandle();
// displayName);
GameProfile gameProfile = new GameProfile(uuid, "");
gameProfile.getProperties().clear();
gameProfile.getProperties().put("textures", new Property("textures", texture, signature));
this.handle = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));
handle.persist = true;
handle.collides = false;
handle.setCustomNameVisible(false);
handle.setInvulnerable(npc.isImmortal());
handle.playerConnection = new PlayerConnection(((CraftServer) Bukkit.getServer()).getServer(), new NetworkManager(EnumProtocolDirection.SERVERBOUND), handle);
((CraftWorld) location.getWorld()).addEntity(handle, CreatureSpawnEvent.SpawnReason.CUSTOM);
handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
registry.register(this);
for (Entity e : getEntity().getNearbyEntities(SPAWN_RADIUS, SPAWN_RADIUS, SPAWN_RADIUS)) {
if (e instanceof Player) {
registry.updateSpawns((Player) e, true);
}
}
}
use of net.minecraft.server.v1_8_R2.WorldServer in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method removeLoader.
@Override
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
Location loaderLoc = chunkLoader.getLocation();
assert loaderLoc.getWorld() != null;
WorldServer world = ((CraftWorld) loaderLoc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loaderLoc.getX(), loaderLoc.getY(), loaderLoc.getZ());
long tileEntityLong = ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4);
TileEntityChunkLoader tileEntityChunkLoader = TileEntityChunkLoader.tileEntityChunkLoaderMap.remove(tileEntityLong);
if (tileEntityChunkLoader != null) {
tileEntityChunkLoader.holograms.forEach(EntityHolograms_v1_16_R3::removeHologram);
tileEntityChunkLoader.removed = true;
world.tileEntityListTick.remove(tileEntityChunkLoader);
}
if (spawnParticle)
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
for (org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
}
}
use of net.minecraft.server.v1_8_R2.WorldServer in project InteractionVisualizer by LOOHP.
the class V1_11 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_11_R1.BlockPosition blockpos = new net.minecraft.server.v1_11_R1.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
AxisAlignedBB box = world.getType(blockpos).d(world, blockpos);
List<BoundingBox> boxes = new ArrayList<>(1);
boxes.add(new BoundingBox(box.a + pos.getX(), box.b + pos.getY(), box.c + pos.getZ(), box.d + pos.getX(), box.e + pos.getY(), box.f + pos.getZ()));
return boxes;
}
use of net.minecraft.server.v1_8_R2.WorldServer in project InteractionVisualizer by LOOHP.
the class V1_12 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_12_R1.BlockPosition blockpos = new net.minecraft.server.v1_12_R1.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
AxisAlignedBB box = world.getType(blockpos).d(world, blockpos);
List<BoundingBox> boxes = new ArrayList<>(1);
boxes.add(new BoundingBox(box.a + pos.getX(), box.b + pos.getY(), box.c + pos.getZ(), box.d + pos.getX(), box.e + pos.getY(), box.f + pos.getZ()));
return boxes;
}
use of net.minecraft.server.v1_8_R2.WorldServer in project InteractionVisualizer by LOOHP.
the class V1_13_1 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_13_R2.BlockPosition blockpos = new net.minecraft.server.v1_13_R2.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
VoxelShape shape = world.getType(blockpos).getShape(world, blockpos);
return shape.d().stream().map(each -> new BoundingBox(each.minX + pos.getX(), each.minY + pos.getY(), each.minZ + pos.getZ(), each.maxX + pos.getX(), each.maxY + pos.getY(), each.maxZ + pos.getZ())).collect(Collectors.toList());
}
Aggregations