Search in sources :

Example 96 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Atlas by funkemunky.

the class BlockBox1_14_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_14_R1.World world = ((org.bukkit.craftbukkit.v1_14_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    net.minecraft.server.v1_14_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
    net.minecraft.server.v1_14_R1.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 : ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) CraftBlock(org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) net.minecraft.server.v1_14_R1(net.minecraft.server.v1_14_R1)

Example 97 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Atlas by funkemunky.

the class BlockBox1_7_R4 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_7_R4.World world = ((org.bukkit.craftbukkit.v1_7_R4.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
    List<AxisAlignedBB> boxes = new ArrayList<>();
    net.minecraft.server.v1_7_R4.Block vblock = CraftMagicNumbers.getBlock(block);
    vblock.a(world, x, y, z, collide, boxes, null);
    if (boxes.size() == 0) {
        AxisAlignedBB box = vblock.a(world, x, y, z);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
        }
        return complexBox;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_7_R4.AxisAlignedBB) ArrayList(java.util.ArrayList) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox)

Example 98 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Atlas by funkemunky.

the class BlockBox1_9_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_9_R1.World world = ((org.bukkit.craftbukkit.v1_9_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
    List<AxisAlignedBB> boxes = new ArrayList<>();
    net.minecraft.server.v1_9_R1.Block vblock = CraftMagicNumbers.getBlock(block);
    BlockPosition blockPos = new BlockPosition(x, y, z);
    vblock.a(vblock.getBlockData(), world, blockPos, collide, boxes, null);
    if (boxes.size() == 0) {
        AxisAlignedBB box = vblock.a(vblock.getBlockData(), world, blockPos);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
        }
        return complexBox;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_9_R1.BlockPosition) ArrayList(java.util.ArrayList) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox)

Example 99 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Atlas by funkemunky.

the class BlockBox1_10_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_10_R1.World world = ((org.bukkit.craftbukkit.v1_10_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
    List<AxisAlignedBB> boxes = new ArrayList<>();
    net.minecraft.server.v1_10_R1.Block vblock = CraftMagicNumbers.getBlock(block);
    BlockPosition blockPos = new BlockPosition(x, y, z);
    vblock.a(vblock.getBlockData(), world, blockPos, collide, boxes, null);
    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.a, box.b, box.c, box.d, box.e, box.f);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
        }
        return complexBox;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_10_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) ArrayList(java.util.ArrayList) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox)

Example 100 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Atlas by funkemunky.

the class BlockBox1_8_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_8_R1.World world = ((org.bukkit.craftbukkit.v1_8_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
    List<AxisAlignedBB> boxes = new ArrayList<>();
    net.minecraft.server.v1_8_R1.Block vblock = CraftMagicNumbers.getBlock(block);
    BlockPosition blockPos = new BlockPosition(x, y, z);
    vblock.a(world, blockPos, vblock.getBlockData(), collide, boxes, null);
    if (boxes.size() == 0) {
        AxisAlignedBB box = vblock.a(world, blockPos, vblock.getBlockData());
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
        }
        return complexBox;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_8_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition) ArrayList(java.util.ArrayList) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox)

Aggregations

List (java.util.List)25 Entity (org.bukkit.entity.Entity)23 Iterator (java.util.Iterator)21 ArrayList (java.util.ArrayList)14 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)14 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)13 HitBox (me.deecaad.weaponmechanics.weapon.projectile.HitBox)12 AxisAlignedBB (net.minecraft.server.v1_11_R1.AxisAlignedBB)12 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)11 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)11 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)9 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)8 LivingEntity (org.bukkit.entity.LivingEntity)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)7 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)7 AxisAlignedBB (net.minecraft.server.v1_9_R2.AxisAlignedBB)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BoundingBox (net.citizensnpcs.api.util.BoundingBox)5 Location (org.bukkit.Location)5 AxisAlignedBB (net.minecraft.server.v1_13_R2.AxisAlignedBB)4