@@ -217,7 +217,7 @@ index 50259042ebafe520342bdb1a4b7e6b9138b8acbd..adf8be12b754c3d9b16ef4a7c675dd2c
217
217
if (this.level().hasChunksAt(blockposition, blockposition1)) {
218
218
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
219
219
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
220
- index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff591276e991 100644
220
+ index bf52aafe542ca735181e461d1f9cbc39b8d88220..87ef8f4953c7d9fddfc9ddbdb027e76145b645c8 100644
221
221
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
222
222
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
223
223
@@ -89,6 +89,8 @@ public class FallingBlockEntity extends Entity {
@@ -242,7 +242,7 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
242
242
world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
243
243
return entityfallingblock;
244
244
}
245
- @@ -188,7 +194,37 @@ public class FallingBlockEntity extends Entity {
245
+ @@ -188,7 +194,43 @@ public class FallingBlockEntity extends Entity {
246
246
// Sakura start
247
247
@Override
248
248
public final double getEyeY() {
@@ -261,6 +261,12 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
261
261
+ return x * x + y * y + z * z;
262
262
+ }
263
263
+
264
+ + private BlockPos patchedBlockPosition() {
265
+ + // mitigate the floating point issue for sand breaking below y-0
266
+ + // 1.0e-12 allows tech that uses indirect collision clipping to still function
267
+ + return BlockPos.containing(this.getX(), this.getY() + 1.0e-12, this.getZ());
268
+ + }
269
+ +
264
270
+ private void removeBlockOnFall(Block block) {
265
271
+ BlockPos blockposition = this.blockPosition();
266
272
+ // Paper start - fix cancelling block falling causing client desync
@@ -281,7 +287,7 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
281
287
}
282
288
// Sakura end
283
289
284
- @@ -204,9 +240 ,16 @@ public class FallingBlockEntity extends Entity {
290
+ @@ -204,9 +246 ,16 @@ public class FallingBlockEntity extends Entity {
285
291
} else {
286
292
Block block = this.blockState.getBlock();
287
293
@@ -299,7 +305,7 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
299
305
}
300
306
301
307
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura
302
- @@ -227,6 +270,11 @@ public class FallingBlockEntity extends Entity {
308
+ @@ -227,8 +276,23 @@ public class FallingBlockEntity extends Entity {
303
309
return;
304
310
}
305
311
// Paper end
@@ -310,8 +316,20 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
310
316
+ // Sakura end
311
317
if (!this.level().isClientSide) {
312
318
BlockPos blockposition = this.blockPosition();
319
+ +
320
+ + // Sakura start
321
+ + // Patching this on modern versions can break some cannons that utilise
322
+ + // the floating point issue. But it makes sense on legacy versions where
323
+ + // that is seemingly not an issue.
324
+ + if (this.physics.before(1_17_0)) {
325
+ + blockposition = this.patchedBlockPosition();
326
+ + }
327
+ + // Sakura end
328
+ +
313
329
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
314
- @@ -253,7 +301,20 @@ public class FallingBlockEntity extends Entity {
330
+ boolean flag1 = flag && this.level().getFluidState(blockposition).is(FluidTags.WATER);
331
+ double d0 = this.getDeltaMovement().lengthSqr();
332
+ @@ -253,7 +317,20 @@ public class FallingBlockEntity extends Entity {
315
333
} else {
316
334
BlockState iblockdata = this.level().getBlockState(blockposition);
317
335
@@ -333,7 +351,7 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..80168d32a95bd960e781751fcf05ff59
333
351
if (!iblockdata.is(Blocks.MOVING_PISTON)) {
334
352
if (!this.cancelDrop) {
335
353
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level(), blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
336
- @@ -321,7 +382 ,12 @@ public class FallingBlockEntity extends Entity {
354
+ @@ -321,7 +398 ,12 @@ public class FallingBlockEntity extends Entity {
337
355
}
338
356
}
339
357
0 commit comments