Add FluidState API

This commit is contained in:
vicisacat
2023-11-17 20:22:43 +01:00
parent b5cda1d98f
commit 380cb52e43
6 changed files with 158 additions and 0 deletions

View File

@@ -108,6 +108,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
return CraftBlock.at(this.getHandle(), new BlockPos(x, y, z)).getState();
}
// Paper start - FluidState API
@Override
public io.papermc.paper.block.fluid.FluidData getFluidData(final int x, final int y, final int z) {
return io.papermc.paper.block.fluid.PaperFluidData.createData(getHandle().getFluidState(new BlockPos(x, y, z)));
}
// Paper end
@Override
public BlockData getBlockData(Location location) {
return this.getBlockData(location.getBlockX(), location.getBlockY(), location.getBlockZ());

View File

@@ -304,4 +304,11 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
return centerChunkZ;
}
// Paper end - Add more LimitedRegion API
// Paper start - Fluid API
@Override
public io.papermc.paper.block.fluid.FluidData getFluidData(int x, int y, int z) {
Preconditions.checkArgument(this.isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z);
return super.getFluidData(x, y, z);
}
// Paper end
}