Files
Purpur/patches/server/0227-Store-placer-on-Block-when-placed.patch
William Blake Galbreath 635d108ae2 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
415f7ca165 Updated Upstream (Bukkit/CraftBukkit)
37df95b189 refactor: do not import List; use FQN
5c65546f5c rebase
fdef125b19 Expose EntityType#getTranslationKey
4d9b14efa4 Use AsyncAppender instead of AsyncLoggerContextSelector to keep loggging IO off main thread (#6381)
8c2adf8e9e Add warning to getOfflinePlayers (#6365)
370b60de14 Optimize indirect passenger iteration (#6366)
80836709e7 Fix block drops position losing precision millions of blocks out (#6387)
e942509e73 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6379)
ce43ce8265 Make EntityUnleashEvent cancellable (#4993)
591cac3685 Configurable item frame map cursor interval (#6385)
e9aa9ce66b Add config migration for named entity death logging option (#6390)
c2f47a76ae Implement Translatable in appropriate places (#6248)
f12a7f57e1 Clear bucket NBT after dispense (#6391)
4dd33cb8b6 [ci skip] Drop "Fix CME on adding a passenger in CreatureSpawnEvent" (#6384)
565cd3306c [ci skip] Add some helper methods to the ObfHelper util class (#6374)

Tuinity Changes:
6fd7e2b376 Update paper
2021-08-14 16:40:13 -05:00

50 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 3 Jul 2021 18:40:32 -0500
Subject: [PATCH] Store placer on Block when placed
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 115f8eb919e90bc4a79db1d0f7875a31cc962f07..d8df4457c28225508d9cb53ed6ea12d2f58648b8 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -381,6 +381,7 @@ public final class ItemStack {
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
+ ((CraftBlock) blockstate.getBlock()).getNMS().getBlock().forgetPlacer(); // Purpur
}
world.preventPoiUpdated = false;
@@ -409,6 +410,7 @@ public final class ItemStack {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
}
+ block.getBlock().forgetPlacer(); // Purpur
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
}
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 94a69b7a1443231cf807fb792478c35334f73e62..2d742ba9d05b599c38b4ffe78b8cf7044652e95f 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -465,7 +465,17 @@ public class Block extends BlockBehaviour implements ItemLike {
Block.dropResources(state, world, pos, blockEntity, player, stack);
}
- public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {}
+ // Purpur start
+ @Nullable protected LivingEntity placer = null;
+
+ public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
+ this.placer = placer;
+ }
+
+ public void forgetPlacer() {
+ this.placer = null;
+ }
+ // Purpur end
public boolean isPossibleToRespawnInThis() {
return !this.material.isSolid() && !this.material.isLiquid();