use of net.minecraft.server.v1_16_R3.AxisAlignedBB 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;
}
}
use of net.minecraft.server.v1_16_R3.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;
}
}
use of net.minecraft.server.v1_16_R3.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;
}
}
use of net.minecraft.server.v1_16_R3.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;
}
}
use of net.minecraft.server.v1_16_R3.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;
}
}
Aggregations