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

Paper Changes:
PaperMC/Paper@29b17a8 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9088)
PaperMC/Paper@b5ce6e3 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9104)
PaperMC/Paper@9cda284 Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@f8c0112 {ci skip} add missing labels to project status map (#9106)
PaperMC/Paper@6a7fef0 Allow entity effect changes off the main thread for worldgen (#8942)
PaperMC/Paper@f8d2f82 Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068)
PaperMC/Paper@b626528 Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@058d7c1 Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@ab72b12 Update Adventure to 4.13.1 (#9113)
PaperMC/Paper@8be7a60 Fix getBrightness and getRawBrightness throwing exception in BlockStateListPopulator (#9111)
PaperMC/Paper@e811927 Revert "Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068)"

Pufferfish Changes:
pufferfish-gg/Pufferfish@da9fd85 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@751dfb0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@c09a154 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@b778163 Updated Upstream (Paper)
2023-04-10 04:07:19 -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 71acec715d65737d0b13392b5b42b607937c2d15..d5c667a9ca5562c2df38e191748f081ef9ffbd68 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -417,6 +417,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;
@@ -446,6 +447,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 4f91e4832a94c3facbc711fcae4cb5ad540a5ca0..84f031ec0f196b90c78a6432f344e68b22d363c0 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -434,7 +434,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() {
return !this.material.isSolid() && !this.material.isLiquid();