Search in sources :

Example 16 with World

use of net.minecraft.server.v1_13_R2.World in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Entity entity = EntityTypes.a(tag, world);
    if (entity == null) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity, SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity, (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_12_R1.Entity) NBTTagCompound(net.minecraft.server.v1_12_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 17 with World

use of net.minecraft.server.v1_13_R2.World in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Entity entity = EntityTypes.a(tag, world);
    if (entity == null) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity, SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity, (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_13_R2.Entity) NBTTagCompound(net.minecraft.server.v1_13_R2.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_13_R2.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld) World(net.minecraft.server.v1_13_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 18 with World

use of net.minecraft.server.v1_13_R2.World in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_14_R1.Entity) NBTTagCompound(net.minecraft.server.v1_14_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_14_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) World(net.minecraft.server.v1_14_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 19 with World

use of net.minecraft.server.v1_13_R2.World in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_15_R1.Entity) NBTTagCompound(net.minecraft.server.v1_15_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_15_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) World(net.minecraft.server.v1_15_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 20 with World

use of net.minecraft.server.v1_13_R2.World in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_16_R2.Entity) NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_16_R2.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer) World(net.minecraft.server.v1_16_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Aggregations

Location (org.bukkit.Location)26 World (net.minecraft.server.v1_16_R3.World)17 World (net.minecraft.server.v1_8_R3.World)16 World (net.minecraft.server.v1_12_R1.World)15 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)15 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)15 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)15 ArrayList (java.util.ArrayList)12 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)11 List (java.util.List)10 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)10 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)10 WildLoadersPlugin (com.bgsoftware.wildloaders.WildLoadersPlugin)8 Hologram (com.bgsoftware.wildloaders.api.holograms.Hologram)8 ChunkLoader (com.bgsoftware.wildloaders.api.loaders.ChunkLoader)8 ChunkLoaderNPC (com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC)8 ITileEntityChunkLoader (com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader)8 WChunkLoader (com.bgsoftware.wildloaders.loaders.WChunkLoader)8 Collection (java.util.Collection)8 Collections (java.util.Collections)8