@@ -36,7 +36,7 @@ index ae2eede559bd9fe7e500ce180f2ac102a95d3856..7ced5ae768cbea9ee0a7bab2365fbaef
36
36
if (xSmaller && z != 0.0) {
37
37
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
38
38
diff --git a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
39
- index 90540b3c8c695e24419b0e0460f0c42f949142b0..a41a831d0e8340312e7c0abeb5da35bf6a8a9d65 100644
39
+ index 4f9880d35347dd008aa2ee6e67f35301ff37a4c0..79d5cd8f90fda2390a64c2d1e0cfca6b66ad83ac 100644
40
40
--- a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
41
41
+++ b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
42
42
@@ -244,10 +244,17 @@ public class SakuraExplosion extends Explosion {
@@ -217,7 +217,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
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 0f1c9eb07c19dd0926521418390855f4bc1bc399..12eed2d1972de15e4d4b953517d47f2b567d3866 100644
220
+ index 0f1c9eb07c19dd0926521418390855f4bc1bc399..99887ed1044cff244074a4584729df50239e9e9a 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 0f1c9eb07c19dd0926521418390855f4bc1bc399..12eed2d1972de15e4d4b953517d47f2b
242
242
world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
243
243
return entityfallingblock;
244
244
}
245
- @@ -188,7 +194,43 @@ public class FallingBlockEntity extends Entity {
245
+ @@ -188,7 +194,44 @@ public class FallingBlockEntity extends Entity {
246
246
// Sakura start
247
247
@Override
248
248
public final double getEyeY() {
@@ -267,27 +267,28 @@ index 0f1c9eb07c19dd0926521418390855f4bc1bc399..12eed2d1972de15e4d4b953517d47f2b
267
267
+ return BlockPos.containing(this.getX(), this.getY() + 1.0e-12, this.getZ());
268
268
+ }
269
269
+
270
+ + private boolean isAbleToStackOnBlock() {
271
+ + BlockPos pos = BlockPos.containing(this.getX(), this.getY() - 0.001f, this.getZ());
272
+ + BlockState state = this.level().getBlockState(pos);
273
+ + return FallingBlock.isFree(state);
274
+ + }
275
+ +
270
276
+ private void removeBlockOnFall(Block block) {
271
277
+ BlockPos blockposition = this.blockPosition();
272
- + // Paper start - fix cancelling block falling causing client desync
273
- + if (!this.level().getBlockState(blockposition).is(block) || !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
274
- + if (this.level().getBlockState(blockposition).is(block)) { //if listener didn't update the block
278
+ + BlockState blockstate = this.level().getBlockState(blockposition);
279
+ +
280
+ + if (blockstate.is(block) && CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
281
+ + this.level().removeBlock(blockposition, false);
282
+ + } else {
283
+ + if (blockstate.is(block)) {
275
284
+ ((ServerLevel) level()).getChunkSource().blockChanged(blockposition);
276
285
+ }
277
286
+ this.discard();
278
- + } else {
279
- + this.level().removeBlock(blockposition, false);
280
287
+ }
281
- + // Paper end - fix cancelling block falling causing client desync
282
- + }
283
- +
284
- + // Why was this special cased for sand in the first place?
285
- + private static boolean isInAir(BlockState state) {
286
- + return state.is(Blocks.FIRE) || state.is(Blocks.AIR) || !state.getFluidState().isEmpty() || state.is(Blocks.WATER) || state.is(Blocks.LAVA);
287
288
}
288
289
// Sakura end
289
290
290
- @@ -204,9 +246 ,16 @@ public class FallingBlockEntity extends Entity {
291
+ @@ -204,9 +247 ,16 @@ public class FallingBlockEntity extends Entity {
291
292
} else {
292
293
Block block = this.blockState.getBlock();
293
294
@@ -305,53 +306,39 @@ index 0f1c9eb07c19dd0926521418390855f4bc1bc399..12eed2d1972de15e4d4b953517d47f2b
305
306
}
306
307
307
308
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura
308
- @@ -227,8 +276,23 @@ public class FallingBlockEntity extends Entity {
309
+ @@ -227,8 +277,16 @@ public class FallingBlockEntity extends Entity {
309
310
return;
310
311
}
311
312
// Paper end
312
313
+ // Sakura start - physics version api
313
314
+ if (this.physics.before(1_12_0)) {
314
315
+ this.scaleDeltaMovement(0.98F);
315
316
+ }
316
- + // Sakura end
317
317
if (!this.level().isClientSide) {
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
- + }
318
+ - BlockPos blockposition = this.blockPosition();
319
+ + // Patching the floating point issue on modern versions can break some cannons that rely on it.
320
+ + // However, it makes sense for legacy versions pre-1.17 before the world height change.
321
+ + BlockPos blockposition = this.physics.before(1_17_0) ? this.patchedBlockPosition() : this.blockPosition();
327
322
+ // Sakura end
328
323
+
329
324
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
330
325
boolean flag1 = flag && this.level().getFluidState(blockposition).is(FluidTags.WATER);
331
326
double d0 = this.getDeltaMovement().lengthSqr();
332
- @@ -253,7 +317,20 @@ public class FallingBlockEntity extends Entity {
327
+ @@ -253,8 +311,11 @@ public class FallingBlockEntity extends Entity {
333
328
} else {
334
329
BlockState iblockdata = this.level().getBlockState(blockposition);
335
330
336
331
- this.multiplyDeltaMovement(0.7D, -0.5D, 0.7D); // Sakura - reduce movement allocations
332
+ - if (!iblockdata.is(Blocks.MOVING_PISTON)) {
337
333
+ // Sakura start - physics version api
338
- + if (!flag1 && this.physics.isWithin(1_9_0, 1_12_0)) {
339
- + BlockPos pos = BlockPos.containing(this.getX(), this.getY() - 0.001f, this.getZ());
340
- + BlockState state = this.level().getBlockState(pos);
341
- + this.onGround = !isInAir(state); // this is how it's implemented between 1.9 and 1.12
342
- +
343
- + if (!this.onGround) {
344
- + iblockdata = Blocks.MOVING_PISTON.defaultBlockState(); // prevent it turning into a solid
345
- + }
346
- + }
347
- +
348
334
+ double friction = this.physics.before(1_14_0) ? 0.7F : 0.7D;
349
335
+ this.multiplyDeltaMovement(friction, -0.5D, friction); // Sakura - reduce movement allocations
350
- + // Sakura end
351
- if (!iblockdata.is(Blocks.MOVING_PISTON)) {
336
+ + if (!iblockdata.is(Blocks.MOVING_PISTON) && (flag1 || !this.physics.isWithin(1_9_0, 1_12_0) || this.isAbleToStackOnBlock())) {
337
+ + // Sakura end
352
338
if (!this.cancelDrop) {
353
339
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level(), blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
354
- @@ -321,7 +398,12 @@ public class FallingBlockEntity extends Entity {
340
+ boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
341
+ @@ -321,7 +382,12 @@ public class FallingBlockEntity extends Entity {
355
342
}
356
343
}
357
344
@@ -459,7 +446,7 @@ index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715
459
446
// Paper end
460
447
}
461
448
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
462
- index d13ba91f2c633517d46f59eaa938fd81d441fedb..7bef41c62d6c96062532233c80b96d6e65a523c8 100644
449
+ index 4c570ea162f0dec00960705ef615d6e9f4a210a7..8a2d9f6526b62080c4b35ff856b8125c32983364 100644
463
450
--- a/src/main/java/net/minecraft/world/level/Explosion.java
464
451
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
465
452
@@ -74,6 +74,7 @@ public class Explosion {
0 commit comments