9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-06 15:41:49 +00:00

Fix falling blocks losing the blockstate when respawning

This commit is contained in:
Samsuik
2024-06-22 16:39:02 +01:00
parent 08eeaa1aee
commit 2e0aa838cd
8 changed files with 23 additions and 22 deletions

View File

@@ -374,10 +374,10 @@ index e657b5f88195f1db2cb9a9a97f255ff23992cadd..5e155cdf66701f96dd0b831603c714b5
if (this.removalReason == null) {
this.removalReason = entity_removalreason;
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 4efdb2c114c96c32ce33593d35552c1c3da53e56..5ddb94427c2502953c5f08c8f7f7958c32208189 100644
index 4efdb2c114c96c32ce33593d35552c1c3da53e56..66b6250dc692e1222ac1661cdd206a1094049a15 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -133,6 +133,59 @@ public class FallingBlockEntity extends Entity {
@@ -133,6 +133,60 @@ public class FallingBlockEntity extends Entity {
return !this.isRemoved();
}
@@ -404,6 +404,7 @@ index 4efdb2c114c96c32ce33593d35552c1c3da53e56..5ddb94427c2502953c5f08c8f7f7958c
+
+ // Try to stack the falling block
+ this.entityState().apply(fallingBlock);
+ fallingBlock.blockState = blockState;
+ fallingBlock.spawnReason = spawnReason;
+ fallingBlock.time = time - 1;
+ fallingBlock.tick();
@@ -437,7 +438,7 @@ index 4efdb2c114c96c32ce33593d35552c1c3da53e56..5ddb94427c2502953c5f08c8f7f7958c
@Override
public void tick() {
if (this.blockState.isAir()) {
@@ -200,6 +253,7 @@ public class FallingBlockEntity extends Entity {
@@ -200,6 +254,7 @@ public class FallingBlockEntity extends Entity {
return;
}
// CraftBukkit end

View File

@@ -201,10 +201,10 @@ index 5e155cdf66701f96dd0b831603c714b5a47d74c0..f6ce2eea92bbea846ec62c7406d19cb3
// Paper start - optimise collisions
final boolean xZero = movement.x == 0.0;
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 99a0bec7eb5be527b41248b365b037a5e42a3270..16a8b667f50700a85f1c14f3a7ed3098e732321a 100644
index 66b6250dc692e1222ac1661cdd206a1094049a15..d2ad54dd3975e2dd8ef26ad28ad1bb2c71ba9f1a 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -198,7 +198,7 @@ public class FallingBlockEntity extends Entity {
@@ -199,7 +199,7 @@ public class FallingBlockEntity extends Entity {
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
}
@@ -214,7 +214,7 @@ index 99a0bec7eb5be527b41248b365b037a5e42a3270..16a8b667f50700a85f1c14f3a7ed3098
if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 8acef487b0579febb3497cc88b23c4fc74492571..9acbc8d5a0c25d7613bfc0c21757ca563954cc0a 100644
index 0c8775fd29fdc811c8a3becb484abf3ed92686c7..dbebba5c36b034270d4c238966957bc25a35aa86 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -96,7 +96,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cannon Mechanics
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 63490856a582db74c47e87d3a2ee414ce2456643..2b6ca6a04013f684397ede74f1d3a295b2dbafd7 100644
index d2ad54dd3975e2dd8ef26ad28ad1bb2c71ba9f1a..eb972c8082ba4371479b8bf691dbfac082a53a2f 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -68,6 +68,7 @@ public class FallingBlockEntity extends Entity {
@@ -24,7 +24,7 @@ index 63490856a582db74c47e87d3a2ee414ce2456643..2b6ca6a04013f684397ede74f1d3a295
}
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
@@ -185,6 +187,12 @@ public class FallingBlockEntity extends Entity {
@@ -186,6 +188,12 @@ public class FallingBlockEntity extends Entity {
return itemEntity;
}
// Sakura end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Despawn falling blocks inside moving pistons
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index fd7524b3aae54bc62dce1c54666f18ad0ea230b4..7bfbdfd4c61941eb6a95ceeb8face277b31735eb 100644
index eb972c8082ba4371479b8bf691dbfac082a53a2f..6cccfdcc33e9ea2a79fe3fec5534e461fd697ecb 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -232,7 +232,7 @@ public class FallingBlockEntity extends Entity {
@@ -233,7 +233,7 @@ public class FallingBlockEntity extends Entity {
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Falling Block Stacking Restrictions
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 7bfbdfd4c61941eb6a95ceeb8face277b31735eb..05c5b6be55bf6a81ff454532b40a372f9b9c8e13 100644
index 6cccfdcc33e9ea2a79fe3fec5534e461fd697ecb..df58cbeffe4e343febce2b27fb38c007afda88c6 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -250,7 +250,7 @@ public class FallingBlockEntity extends Entity {
@@ -251,7 +251,7 @@ public class FallingBlockEntity extends Entity {
boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
boolean flag4 = this.blockState.canSurvive(this.level(), blockposition) && !flag3;

View File

@@ -255,7 +255,7 @@ index a4dc4154550bb4bd30d3e548f145cff5c693dc18..33ad3583a524bb61cc7116b50e0fc87f
if (this.level().hasChunksAt(blockposition, blockposition1)) {
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2b1268739 100644
index df58cbeffe4e343febce2b27fb38c007afda88c6..e7aa5b0f976c8bf236240c4c9708ea1751a03629 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -90,6 +90,8 @@ public class FallingBlockEntity extends Entity {
@@ -280,7 +280,7 @@ index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2
world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
return entityfallingblock;
}
@@ -190,9 +196,46 @@ public class FallingBlockEntity extends Entity {
@@ -191,9 +197,46 @@ public class FallingBlockEntity extends Entity {
// Sakura start
@Override
public final double getEyeY() {
@@ -328,7 +328,7 @@ index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2
@Override
public void tick() {
@@ -201,9 +244,16 @@ public class FallingBlockEntity extends Entity {
@@ -202,9 +245,16 @@ public class FallingBlockEntity extends Entity {
} else {
Block block = this.blockState.getBlock();
@@ -346,7 +346,7 @@ index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2
}
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
@@ -217,8 +267,16 @@ public class FallingBlockEntity extends Entity {
@@ -218,8 +268,16 @@ public class FallingBlockEntity extends Entity {
return;
}
// Paper end - Configurable falling blocks height nerf
@@ -364,7 +364,7 @@ index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
boolean flag1 = flag && this.level().getFluidState(blockposition).is(FluidTags.WATER);
double d0 = this.getDeltaMovement().lengthSqr();
@@ -243,8 +301,11 @@ public class FallingBlockEntity extends Entity {
@@ -244,8 +302,11 @@ public class FallingBlockEntity extends Entity {
} else {
BlockState iblockdata = this.level().getBlockState(blockposition);
@@ -378,7 +378,7 @@ index 21f827678437ea538f0130812c9869e3619041a5..8c34808770e590ea3308d81f891ab1f2
if (!this.cancelDrop) {
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level(), blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
@@ -311,7 +372,12 @@ public class FallingBlockEntity extends Entity {
@@ -312,7 +373,12 @@ public class FallingBlockEntity extends Entity {
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Configure concrete solidifying in water
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index b5ecadeb96750cbdca2023eefe7778596a040c97..fd043df496bded2fb18dae0b8053cd45c5d8c500 100644
index e7aa5b0f976c8bf236240c4c9708ea1751a03629..46cc4243bbe4700e4543a531ee40bc504d7c6956 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -277,7 +277,7 @@ public class FallingBlockEntity extends Entity {
@@ -278,7 +278,7 @@ public class FallingBlockEntity extends Entity {
BlockPos blockposition = this.physics.before(1_17_0) ? this.patchedBlockPosition() : this.blockPosition();
// Sakura end - physics version api

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Fix doEntityDrops gamerule preventing falling blocks from
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index fd043df496bded2fb18dae0b8053cd45c5d8c500..b773a8b831f1d65f6d442e95b1ab685170567a9c 100644
index 46cc4243bbe4700e4543a531ee40bc504d7c6956..ab88fc1db9740ab249b332a6c01a6d6e2a998c1c 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -352,10 +352,14 @@ public class FallingBlockEntity extends Entity {
@@ -353,10 +353,14 @@ public class FallingBlockEntity extends Entity {
tileentity.setChanged();
}
}