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());
}
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;
}
}
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;
}
}
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;
}
}
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;
}
Aggregations