Search in sources :

Example 6 with WorldServer

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);
        }
    }
}
Also used : Entity(org.bukkit.entity.Entity) PacketPlayOutEntity(net.minecraft.server.v1_16_R3.PacketPlayOutEntity) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) GameProfile(com.mojang.authlib.GameProfile) PlayerInteractManager(net.minecraft.server.v1_16_R3.PlayerInteractManager) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) DedicatedServer(net.minecraft.server.v1_16_R3.DedicatedServer) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftServer(org.bukkit.craftbukkit.v1_16_R3.CraftServer) NetworkManager(net.minecraft.server.v1_16_R3.NetworkManager) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) Property(com.mojang.authlib.properties.Property) PlayerConnection(net.minecraft.server.v1_16_R3.PlayerConnection)

Example 7 with WorldServer

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);
    }
}
Also used : NBTTagLong(net.minecraft.server.v1_16_R3.NBTTagLong) ChunkLoader(com.bgsoftware.wildloaders.api.loaders.ChunkLoader) Block(net.minecraft.server.v1_16_R3.Block) IBlockData(net.minecraft.server.v1_16_R3.IBlockData) TileEntityMobSpawner(net.minecraft.server.v1_16_R3.TileEntityMobSpawner) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) WChunkLoader(com.bgsoftware.wildloaders.loaders.WChunkLoader) Location(org.bukkit.Location) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) Map(java.util.Map) WildLoadersPlugin(com.bgsoftware.wildloaders.WildLoadersPlugin) ITileEntityChunkLoader(com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader) Hologram(com.bgsoftware.wildloaders.api.holograms.Hologram) CraftItemStack(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack) NBTTagList(net.minecraft.server.v1_16_R3.NBTTagList) TileEntity(net.minecraft.server.v1_16_R3.TileEntity) World(net.minecraft.server.v1_16_R3.World) NBTTagString(net.minecraft.server.v1_16_R3.NBTTagString) TileEntityTypes(net.minecraft.server.v1_16_R3.TileEntityTypes) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) Collection(java.util.Collection) UUID(java.util.UUID) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) ChunkCoordIntPair(net.minecraft.server.v1_16_R3.ChunkCoordIntPair) ITickable(net.minecraft.server.v1_16_R3.ITickable) ItemStack(net.minecraft.server.v1_16_R3.ItemStack) List(java.util.List) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftChunk(org.bukkit.craftbukkit.v1_16_R3.CraftChunk) Chunk(net.minecraft.server.v1_16_R3.Chunk) ChunkLoaderNPC(com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC) Collections(java.util.Collections) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftChunk(org.bukkit.craftbukkit.v1_16_R3.CraftChunk) Chunk(net.minecraft.server.v1_16_R3.Chunk) ITileEntityChunkLoader(com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader) TileEntityMobSpawner(net.minecraft.server.v1_16_R3.TileEntityMobSpawner) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftChunk(org.bukkit.craftbukkit.v1_16_R3.CraftChunk) Location(org.bukkit.Location)

Example 8 with WorldServer

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;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_11_R1.AxisAlignedBB) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ArrayList(java.util.ArrayList) WorldServer(net.minecraft.server.v1_11_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 9 with WorldServer

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;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_12_R1.AxisAlignedBB) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ArrayList(java.util.ArrayList) WorldServer(net.minecraft.server.v1_12_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 10 with WorldServer

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());
}
Also used : CraftMagicNumbers(org.bukkit.craftbukkit.v1_13_R2.util.CraftMagicNumbers) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) EntityItem(net.minecraft.server.v1_13_R2.EntityItem) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld) Item(org.bukkit.entity.Item) VoxelShape(net.minecraft.server.v1_13_R2.VoxelShape) Block(org.bukkit.block.Block) TileEntityType(com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType) World(org.bukkit.World) CraftChunk(org.bukkit.craftbukkit.v1_13_R2.CraftChunk) WrappedIterable(com.loohp.interactionvisualizer.objectholders.WrappedIterable) WorldServer(net.minecraft.server.v1_13_R2.WorldServer) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) CraftItem(org.bukkit.craftbukkit.v1_13_R2.entity.CraftItem) ChunkPosition(com.loohp.interactionvisualizer.objectholders.ChunkPosition) InteractionVisualizer(com.loohp.interactionvisualizer.InteractionVisualizer) Entity(org.bukkit.entity.Entity) ValuePairs(com.loohp.interactionvisualizer.objectholders.ValuePairs) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ItemSlot(com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot) TileEntity(com.loohp.interactionvisualizer.objectholders.TileEntity) PacketType(com.comphenix.protocol.PacketType) Collectors(java.util.stream.Collectors) ItemStack(org.bukkit.inventory.ItemStack) NMSTileEntitySet(com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet) PacketContainer(com.comphenix.protocol.events.PacketContainer) List(java.util.List) VoxelShape(net.minecraft.server.v1_13_R2.VoxelShape) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) WorldServer(net.minecraft.server.v1_13_R2.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Aggregations

WorldServer (net.minecraft.server.v1_16_R3.WorldServer)24 WorldServer (net.minecraft.server.v1_12_R1.WorldServer)20 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)19 ArrayList (java.util.ArrayList)18 List (java.util.List)16 UUID (java.util.UUID)16 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)16 GameProfile (com.mojang.authlib.GameProfile)15 WorldServer (net.minecraft.server.v1_11_R1.WorldServer)15 Material (org.bukkit.Material)15 WorldServer (net.minecraft.server.v1_14_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_15_R1.WorldServer)14 WorldServer (net.minecraft.server.v1_10_R1.WorldServer)13 Block (org.bukkit.block.Block)13 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)13 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)12 WorldServer (net.minecraft.server.v1_8_R3.WorldServer)12 LivingEntity (org.bukkit.entity.LivingEntity)12 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)11 WorldServer (net.minecraft.server.v1_13_R2.WorldServer)10