Search in sources :

Example 11 with VoxelShape

use of net.minecraft.server.v1_16_R3.VoxelShape in project Citizens2 by CitizensDev.

the class NMSImpl method getCollisionBox.

@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
    WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
    VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
    return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}
Also used : VoxelShape(net.minecraft.server.v1_16_R3.VoxelShape) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 12 with VoxelShape

use of net.minecraft.server.v1_16_R3.VoxelShape in project Citizens2 by CitizensDev.

the class NMSImpl method getCollisionBox.

@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
    WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
    VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
    return shape.isEmpty() ? new BoundingBox(0, 0, 0, 0, 0, 0) : NMSBoundingBox.wrap(shape.getBoundingBox());
}
Also used : VoxelShape(net.minecraft.server.v1_14_R1.VoxelShape) BoundingBox(net.citizensnpcs.api.util.BoundingBox) WorldServer(net.minecraft.server.v1_14_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 13 with VoxelShape

use of net.minecraft.server.v1_16_R3.VoxelShape in project Citizens2 by CitizensDev.

the class NMSImpl method getCollisionBox.

@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
    WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
    VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
    return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}
Also used : VoxelShape(net.minecraft.server.v1_13_R2.VoxelShape) WorldServer(net.minecraft.server.v1_13_R2.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 14 with VoxelShape

use of net.minecraft.server.v1_16_R3.VoxelShape in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method aa.

public static double aa(IBlockAccess var0, BlockPosition var1) {
    BlockPosition var2 = var1.down();
    VoxelShape var3 = var0.getType(var2).getCollisionShape(var0, var2);
    return var2.getY() + (var3.isEmpty() ? 0.0D : var3.c(EnumDirection.EnumAxis.Y));
}
Also used : VoxelShape(net.minecraft.server.v1_16_R3.VoxelShape) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition)

Example 15 with VoxelShape

use of net.minecraft.server.v1_16_R3.VoxelShape in project Atlas by funkemunky.

the class BlockBox1_16_R3 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(org.bukkit.block.Block block) {
    final net.minecraft.server.v1_16_R3.World world = ((org.bukkit.craftbukkit.v1_16_R3.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    net.minecraft.server.v1_16_R3.IBlockData iblockData = ((CraftBlock) block).getNMS();
    net.minecraft.server.v1_16_R3.Block vblock = iblockData.getBlock();
    BlockPosition blockPos = new BlockPosition(x, y, z);
    VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
    List<AxisAlignedBB> boxes = shape.d();
    if (boxes.size() == 0) {
        return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
        }
        return complexBox;
    }
}
Also used : World(net.minecraft.server.v1_16_R3.World) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) CraftBlock(org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) net.minecraft.server.v1_16_R3(net.minecraft.server.v1_16_R3) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Aggregations

PacketContainer (com.comphenix.protocol.events.PacketContainer)7 BlockPosition (com.loohp.interactionvisualizer.objectholders.BlockPosition)7 BoundingBox (com.loohp.interactionvisualizer.objectholders.BoundingBox)7 ChunkPosition (com.loohp.interactionvisualizer.objectholders.ChunkPosition)7 NMSTileEntitySet (com.loohp.interactionvisualizer.objectholders.NMSTileEntitySet)7 TileEntity (com.loohp.interactionvisualizer.objectholders.TileEntity)7 TileEntityType (com.loohp.interactionvisualizer.objectholders.TileEntity.TileEntityType)7 ValuePairs (com.loohp.interactionvisualizer.objectholders.ValuePairs)7 WrappedIterable (com.loohp.interactionvisualizer.objectholders.WrappedIterable)7 List (java.util.List)7 Collectors (java.util.stream.Collectors)7 Material (org.bukkit.Material)7 World (org.bukkit.World)7 Block (org.bukkit.block.Block)7 Entity (org.bukkit.entity.Entity)7 Item (org.bukkit.entity.Item)7 EquipmentSlot (org.bukkit.inventory.EquipmentSlot)7 ItemStack (org.bukkit.inventory.ItemStack)7 PacketType (com.comphenix.protocol.PacketType)4 ItemSlot (com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot)4