aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0382-Fix-sand-duping.patch
blob: f99be8b6c7b3b8ba4486307f6d5056c1207dc586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 13:33:19 -0700
Subject: [PATCH] Fix sand duping

If the falling block dies during teleportation (entity#move), then we need
to detect that by placing a check after the move.

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 c0477f913867c67809978a4f240303151d81e6ea..33cc2d1a4723ec07c4201eb6e0080d5e0281e1f0 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -132,6 +132,11 @@ public class FallingBlockEntity extends Entity {
 
     @Override
     public void tick() {
+        // Paper start - fix sand duping
+        if (this.isRemoved()) {
+            return;
+        }
+        // Paper end - fix sand duping
         if (this.blockState.isAir()) {
             this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
         } else {
@@ -143,6 +148,11 @@ public class FallingBlockEntity extends Entity {
             }
 
             this.move(MoverType.SELF, this.getDeltaMovement());
+            // Paper start - fix sand duping
+            if (this.isRemoved()) {
+                return;
+            }
+            // Paper end - fix sand duping
             // Paper start - Configurable falling blocks height nerf
             if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
                 if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {