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

Paper Changes:
PaperMC/Paper@2fa8efc Updated Upstream (Bukkit/CraftBukkit) (#9485)
PaperMC/Paper@508a295 Only erase allay memory on non-item targets (#9570)
PaperMC/Paper@31358d5 API for updating recipes on clients (#6463)
PaperMC/Paper@8fe8ca6 Add clickable version on version command (#9347)
PaperMC/Paper@d6d2b6f Only capture actual tree growth (#6464)
2023-08-05 20:40:50 -07: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 a7909c60a17ab004ab8f6cd39abb211887bdeb90..8c8f605c4d17e2dd5dec450bd4f9853421b0f44a 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -426,6 +426,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;
@@ -455,6 +456,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 9522e646529f3d849471931b4b3c0d133e7fcfc5..91832d8ed048e3b78f156bcbe265955dd93b3c9a 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -422,7 +422,17 @@ public class Block extends BlockBehaviour implements ItemLike {
Block.dropResources(state, world, pos, blockEntity, player, tool);
}
- 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();