0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 03:06:17 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/IBlockAccess.patch
2024-10-23 02:15:00 +11:00

45 lines
2.4 KiB
Diff

--- a/net/minecraft/world/level/IBlockAccess.java
+++ b/net/minecraft/world/level/IBlockAccess.java
@@ -31,7 +31,7 @@
default <T extends TileEntity> Optional<T> getBlockEntity(BlockPosition blockposition, TileEntityTypes<T> tileentitytypes) {
TileEntity tileentity = this.getBlockEntity(blockposition);
- return tileentity != null && tileentity.getType() == tileentitytypes ? Optional.of(tileentity) : Optional.empty();
+ return tileentity != null && tileentity.getType() == tileentitytypes ? (Optional<T>) Optional.of(tileentity) : Optional.empty(); // CraftBukkit - decompile error
}
IBlockData getBlockState(BlockPosition blockposition);
@@ -59,8 +59,8 @@
});
}
- default MovingObjectPositionBlock clip(RayTrace raytrace) {
- return (MovingObjectPositionBlock) traverseBlocks(raytrace.getFrom(), raytrace.getTo(), raytrace, (raytrace1, blockposition) -> {
+ // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
+ default MovingObjectPositionBlock clip(RayTrace raytrace1, BlockPosition blockposition) {
IBlockData iblockdata = this.getBlockState(blockposition);
Fluid fluid = this.getFluidState(blockposition);
Vec3D vec3d = raytrace1.getFrom();
@@ -73,6 +73,12 @@
double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.getFrom().distanceToSqr(movingobjectpositionblock1.getLocation());
return d0 <= d1 ? movingobjectpositionblock : movingobjectpositionblock1;
+ }
+ // CraftBukkit end
+
+ default MovingObjectPositionBlock clip(RayTrace raytrace) {
+ return (MovingObjectPositionBlock) traverseBlocks(raytrace.getFrom(), raytrace.getTo(), raytrace, (raytrace1, blockposition) -> {
+ return this.clip(raytrace1, blockposition); // CraftBukkit - moved into separate method
}, (raytrace1) -> {
Vec3D vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
@@ -145,7 +151,7 @@
double d13 = d10 * (i1 > 0 ? 1.0D - MathHelper.frac(d4) : MathHelper.frac(d4));
double d14 = d11 * (j1 > 0 ? 1.0D - MathHelper.frac(d5) : MathHelper.frac(d5));
- Object object;
+ T object; // CraftBukkit - decompile error
do {
if (d12 > 1.0D && d13 > 1.0D && d14 > 1.0D) {