Search in sources :

Example 81 with World

use of net.minecraft.server.v1_16_R1.World in project InteractionVisualizer by LOOHP.

the class V1_16 method getBoundingBoxes.

public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
    net.minecraft.server.v1_16_R1.BlockPosition blockpos = new net.minecraft.server.v1_16_R1.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 : BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) EntityItem(net.minecraft.server.v1_16_R1.EntityItem) Item(org.bukkit.entity.Item) CraftChunk(org.bukkit.craftbukkit.v1_16_R1.CraftChunk) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld) VoxelShape(net.minecraft.server.v1_16_R1.VoxelShape) CraftItem(org.bukkit.craftbukkit.v1_16_R1.entity.CraftItem) WorldServer(net.minecraft.server.v1_16_R1.WorldServer) ArrayList(java.util.ArrayList) Block(org.bukkit.block.Block) TileEntityType(com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType) World(org.bukkit.World) WrappedIterable(com.loohp.interactionvisualizer.objectholders.WrappedIterable) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) ChunkPosition(com.loohp.interactionvisualizer.objectholders.ChunkPosition) Entity(org.bukkit.entity.Entity) ValuePairs(com.loohp.interactionvisualizer.objectholders.ValuePairs) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) TileEntity(com.loohp.interactionvisualizer.objectholders.TileEntity) Collectors(java.util.stream.Collectors) Pair(com.mojang.datafixers.util.Pair) CraftItemStack(org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack) NMSTileEntitySet(com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet) PacketContainer(com.comphenix.protocol.events.PacketContainer) List(java.util.List) EnumItemSlot(net.minecraft.server.v1_16_R1.EnumItemSlot) PacketPlayOutEntityEquipment(net.minecraft.server.v1_16_R1.PacketPlayOutEntityEquipment) CraftMagicNumbers(org.bukkit.craftbukkit.v1_16_R1.util.CraftMagicNumbers) VoxelShape(net.minecraft.server.v1_16_R1.VoxelShape) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) WorldServer(net.minecraft.server.v1_16_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld)

Example 82 with World

use of net.minecraft.server.v1_16_R1.World in project TheAPI by TheDevTec.

the class v1_16_R1 method packetBlockChange.

@Override
public Object packetBlockChange(World world, int x, int y, int z) {
    PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange();
    packet.block = (IBlockData) getBlock(getChunk(world, x >> 4, z >> 4), x, y, z);
    try {
        pos.set(packet, new BlockPosition(x, y, z));
    } catch (Exception e) {
    }
    return packet;
}
Also used : BlockPosition(net.minecraft.server.v1_16_R1.BlockPosition) PacketPlayOutBlockChange(net.minecraft.server.v1_16_R1.PacketPlayOutBlockChange)

Example 83 with World

use of net.minecraft.server.v1_16_R1.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_R1.Entity) NBTTagCompound(net.minecraft.server.v1_16_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_16_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld) World(net.minecraft.server.v1_16_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld)

Example 84 with World

use of net.minecraft.server.v1_16_R1.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_R3.Entity) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 85 with World

use of net.minecraft.server.v1_16_R1.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_8_R3.Entity) NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Aggregations

Location (org.bukkit.Location)26 World (net.minecraft.server.v1_16_R3.World)16 World (net.minecraft.server.v1_12_R1.World)15 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)15 World (net.minecraft.server.v1_8_R3.World)14 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)14 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