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

Paper Changes:
6fd9275 Fix Bossbar updating (closes #6061) (#6076)

Tuinity Changes:
a4009b4 Apply paper's reobf mappings patch
a7dcd62 Make getHardCollidingEntities only return hard colliding entities
2021-07-03 19:55:11 -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 4be9924556e0f447dbe6a53c2d4cb7fb89dac455..0554261342308573551f05413a45a7592d32ca64 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -382,6 +382,7 @@ public final class ItemStack {
// revert back all captured blocks
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
+ ((CraftBlock) blockstate.getBlock()).getNMS().getBlock().forgetPlacer(); // Purpur
}
// Brute force all possible updates
@@ -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 99d05dbe7d7d9bcc1c5f5b3dd02e413e3a398a10..8189dbf510702e81e86ff0070d4819fac1bfef03 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -461,7 +461,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();