Files
Purpur/patches/server/0189-Store-placer-on-Block-when-placed.patch
granny e4d30e02fd Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@e84621a [ci skip] Add more patch identifying comments
PaperMC/Paper@c0e4697 [ci skip] Add more patch identifying comments
PaperMC/Paper@17275ff [ci skip] add more comments & move 1 hunk to correct patch
PaperMC/Paper@78fcb8e [ci skip] Update contributing guidelines to include identifying commit titles in comments (#10162)
PaperMC/Paper@8657cd9 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10164)
PaperMC/Paper@c151c95 Fixup AsyncPreLoginEvent patches
PaperMC/Paper@93a848c Readd missed line
PaperMC/Paper@f9fdedf [ci skip] Add more patch identifying comments, merge related patches
PaperMC/Paper@0ef5984 [ci skip] Add more patch identifying comments, merge related patches
2024-01-15 23:22:28 -08: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 7490893e2e419e3b8d15bf1b2fa776c6e07a7dec..4122154bdefca80286a8da128feee31f5fa183ee 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -453,6 +453,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;
@@ -484,6 +485,7 @@ public final class ItemStack {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, context); // Paper - pass context
}
+ 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 3f2fdf73e2e520838c7b59fe994e67ab2d1a4d6b..cd9996b03974d44ba0285a6eab7d2923c2533446 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -445,7 +445,17 @@ public class Block extends BlockBehaviour implements ItemLike {
} // Paper - fix drops not preventing stats/food exhaustion
}
- 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(BlockState state) {
return !state.isSolid() && !state.liquid();