Search in sources :

Example 26 with CraftWorld

use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project InteractionVisualizer by LOOHP.

the class V1_16_4 method getBoundingBoxes.

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

Example 27 with CraftWorld

use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project InteractionVisualizer by LOOHP.

the class V1_17 method getBoundingBoxes.

@SuppressWarnings("unchecked")
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
    net.minecraft.core.BlockPosition blockpos = new net.minecraft.core.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
    WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
    try {
        VoxelShape shape = (VoxelShape) blockDataGetShape.invoke(worldServerGetType.invoke(blockpos), world, blockpos);
        return ((List<AxisAlignedBB>) voxelShapeGetAABBList.invoke(shape)).stream().map(each -> new BoundingBox(each.a + pos.getX(), each.b + pos.getY(), each.c + pos.getZ(), each.d + pos.getX(), each.e + pos.getY(), each.f + pos.getZ())).collect(Collectors.toList());
    } catch (Exception e) {
        List<BoundingBox> boxes = new ArrayList<>();
        boxes.add(BoundingBox.of(pos.getBlock()));
        return boxes;
    }
}
Also used : BlockData(net.minecraft.world.level.block.state.BlockBase.BlockData) WorldServer(net.minecraft.server.level.WorldServer) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) IBlockAccess(net.minecraft.world.level.IBlockAccess) Item(org.bukkit.entity.Item) PacketPlayOutEntityDestroy(net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy) PacketPlayOutEntityEquipment(net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment) ArrayList(java.util.ArrayList) Block(org.bukkit.block.Block) Chunk(net.minecraft.world.level.chunk.Chunk) CraftItem(org.bukkit.craftbukkit.v1_17_R1.entity.CraftItem) TileEntityType(com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType) World(org.bukkit.World) Map(java.util.Map) WrappedIterable(com.loohp.interactionvisualizer.objectholders.WrappedIterable) Method(java.lang.reflect.Method) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CraftChunk(org.bukkit.craftbukkit.v1_17_R1.CraftChunk) ChunkPosition(com.loohp.interactionvisualizer.objectholders.ChunkPosition) EntityItem(net.minecraft.world.entity.item.EntityItem) LevelEntityGetter(net.minecraft.world.level.entity.LevelEntityGetter) CraftMagicNumbers(org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers) InteractionVisualizer(com.loohp.interactionvisualizer.InteractionVisualizer) Entity(org.bukkit.entity.Entity) ValuePairs(com.loohp.interactionvisualizer.objectholders.ValuePairs) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) TileEntity(com.loohp.interactionvisualizer.objectholders.TileEntity) AxisAlignedBB(net.minecraft.world.phys.AxisAlignedBB) PacketType(com.comphenix.protocol.PacketType) Field(java.lang.reflect.Field) Collectors(java.util.stream.Collectors) Pair(com.mojang.datafixers.util.Pair) ItemStack(org.bukkit.inventory.ItemStack) InvocationTargetException(java.lang.reflect.InvocationTargetException) NMSTileEntitySet(com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet) PacketContainer(com.comphenix.protocol.events.PacketContainer) List(java.util.List) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) EnumItemSlot(net.minecraft.world.entity.EnumItemSlot) CraftItemStack(org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) WorldServer(net.minecraft.server.level.WorldServer) InvocationTargetException(java.lang.reflect.InvocationTargetException) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ArrayList(java.util.ArrayList) List(java.util.List) CraftWorld(org.bukkit.craftbukkit.v1_17_R1.CraftWorld)

Example 28 with CraftWorld

use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project InteractionVisualizer by LOOHP.

the class V1_18 method getBoundingBoxes.

@SuppressWarnings("unchecked")
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
    net.minecraft.core.BlockPosition blockpos = new net.minecraft.core.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
    WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
    VoxelShape shape = world.a_(blockpos).j(world, blockpos);
    try {
        return ((List<AxisAlignedBB>) voxelShapeGetAABBList.invoke(shape)).stream().map(each -> new BoundingBox(each.a + pos.getX(), each.b + pos.getY(), each.c + pos.getZ(), each.d + pos.getX(), each.e + pos.getY(), each.f + pos.getZ())).collect(Collectors.toList());
    } catch (Exception e) {
        List<BoundingBox> boxes = new ArrayList<>();
        boxes.add(BoundingBox.of(pos.getBlock()));
        return boxes;
    }
}
Also used : WorldServer(net.minecraft.server.level.WorldServer) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) Item(org.bukkit.entity.Item) CraftItemStack(org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack) PacketPlayOutEntityDestroy(net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy) PacketPlayOutEntityEquipment(net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment) ArrayList(java.util.ArrayList) Block(org.bukkit.block.Block) CraftMagicNumbers(org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers) TileEntityType(com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType) World(org.bukkit.World) WrappedIterable(com.loohp.interactionvisualizer.objectholders.WrappedIterable) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld) Method(java.lang.reflect.Method) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) CraftChunk(org.bukkit.craftbukkit.v1_18_R1.CraftChunk) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ChunkPosition(com.loohp.interactionvisualizer.objectholders.ChunkPosition) EntityItem(net.minecraft.world.entity.item.EntityItem) InteractionVisualizer(com.loohp.interactionvisualizer.InteractionVisualizer) Entity(org.bukkit.entity.Entity) ValuePairs(com.loohp.interactionvisualizer.objectholders.ValuePairs) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) TileEntity(com.loohp.interactionvisualizer.objectholders.TileEntity) AxisAlignedBB(net.minecraft.world.phys.AxisAlignedBB) PacketType(com.comphenix.protocol.PacketType) Field(java.lang.reflect.Field) Collectors(java.util.stream.Collectors) Pair(com.mojang.datafixers.util.Pair) ItemStack(org.bukkit.inventory.ItemStack) InvocationTargetException(java.lang.reflect.InvocationTargetException) NMSTileEntitySet(com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet) PacketContainer(com.comphenix.protocol.events.PacketContainer) List(java.util.List) PersistentEntitySectionManager(net.minecraft.world.level.entity.PersistentEntitySectionManager) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) Collections(java.util.Collections) EnumItemSlot(net.minecraft.world.entity.EnumItemSlot) CraftItem(org.bukkit.craftbukkit.v1_18_R1.entity.CraftItem) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) WorldServer(net.minecraft.server.level.WorldServer) InvocationTargetException(java.lang.reflect.InvocationTargetException) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ArrayList(java.util.ArrayList) List(java.util.List) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld)

Example 29 with CraftWorld

use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project InteractionVisualizer by LOOHP.

the class V1_18_2 method getBoundingBoxes.

@SuppressWarnings("unchecked")
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
    net.minecraft.core.BlockPosition blockpos = new net.minecraft.core.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
    WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
    VoxelShape shape = world.a_(blockpos).j(world, blockpos);
    try {
        return ((List<AxisAlignedBB>) voxelShapeGetAABBList.invoke(shape)).stream().map(each -> new BoundingBox(each.a + pos.getX(), each.b + pos.getY(), each.c + pos.getZ(), each.d + pos.getX(), each.e + pos.getY(), each.f + pos.getZ())).collect(Collectors.toList());
    } catch (Exception e) {
        List<BoundingBox> boxes = new ArrayList<>();
        boxes.add(BoundingBox.of(pos.getBlock()));
        return boxes;
    }
}
Also used : WorldServer(net.minecraft.server.level.WorldServer) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) Item(org.bukkit.entity.Item) PacketPlayOutEntityDestroy(net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy) PacketPlayOutEntityEquipment(net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld) CraftChunk(org.bukkit.craftbukkit.v1_18_R2.CraftChunk) 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) Method(java.lang.reflect.Method) Material(org.bukkit.Material) EquipmentSlot(org.bukkit.inventory.EquipmentSlot) ChunkPosition(com.loohp.interactionvisualizer.objectholders.ChunkPosition) EntityItem(net.minecraft.world.entity.item.EntityItem) InteractionVisualizer(com.loohp.interactionvisualizer.InteractionVisualizer) Entity(org.bukkit.entity.Entity) ValuePairs(com.loohp.interactionvisualizer.objectholders.ValuePairs) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) CraftItem(org.bukkit.craftbukkit.v1_18_R2.entity.CraftItem) TileEntity(com.loohp.interactionvisualizer.objectholders.TileEntity) AxisAlignedBB(net.minecraft.world.phys.AxisAlignedBB) PacketType(com.comphenix.protocol.PacketType) Collectors(java.util.stream.Collectors) Pair(com.mojang.datafixers.util.Pair) ItemStack(org.bukkit.inventory.ItemStack) NMSTileEntitySet(com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet) PacketContainer(com.comphenix.protocol.events.PacketContainer) CraftMagicNumbers(org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers) List(java.util.List) CraftItemStack(org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) EnumItemSlot(net.minecraft.world.entity.EnumItemSlot) BlockPosition(com.loohp.interactionvisualizer.objectholders.BlockPosition) WorldServer(net.minecraft.server.level.WorldServer) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) BoundingBox(com.loohp.interactionvisualizer.objectholders.BoundingBox) ArrayList(java.util.ArrayList) List(java.util.List) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld)

Example 30 with CraftWorld

use of org.bukkit.craftbukkit.v1_19_R1.CraftWorld in project dynmap by webbukkit.

the class MapChunkCache118_2 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().getChunkIfLoaded(chunk.x, chunk.z);
        if ((c != null) && c.o) {
            // c.loaded
            nbt = ChunkRegionLoader.a(cw.getHandle(), c);
        }
        if (nbt != null) {
            gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
        }
    }
    return gc;
}
Also used : GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GenericChunk(org.dynmap.common.chunk.GenericChunk) Chunk(net.minecraft.world.level.chunk.Chunk) DynmapChunk(org.dynmap.DynmapChunk) CraftWorld(org.bukkit.craftbukkit.v1_18_R2.CraftWorld)

Aggregations

ServerLevel (net.minecraft.server.level.ServerLevel)147 Location (org.bukkit.Location)131 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)111 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)103 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)95 BlockPos (net.minecraft.core.BlockPos)83 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)74 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)66 ItemStack (org.bukkit.inventory.ItemStack)61 Block (org.bukkit.block.Block)57 LivingEntity (org.bukkit.entity.LivingEntity)54 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)53 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)47 ArrayList (java.util.ArrayList)43 World (org.bukkit.World)41 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)39 Entity (org.bukkit.entity.Entity)39 Level (net.minecraft.world.level.Level)38 List (java.util.List)34 GameProfile (com.mojang.authlib.GameProfile)32