use of com.loohp.interactionvisualizer.objectholders.BoundingBox in project InteractionVisualizer by LOOHP.
the class V1_16_2 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_16_R2.BlockPosition blockpos = new net.minecraft.server.v1_16_R2.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());
}
use of com.loohp.interactionvisualizer.objectholders.BoundingBox 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());
}
use of com.loohp.interactionvisualizer.objectholders.BoundingBox 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;
}
}
use of com.loohp.interactionvisualizer.objectholders.BoundingBox 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;
}
}
use of com.loohp.interactionvisualizer.objectholders.BoundingBox 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;
}
}
Aggregations