mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
50 lines
2.7 KiB
Diff
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 f7017c330ee2d8e17ab2be294865d7e3fd796456..1626f86d8765509618b9ca59fb67b6b772802431 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -404,6 +404,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;
|
|
|
|
@@ -433,6 +434,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 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..efed0ad72cfbea820bfb454ea4fb893007734908 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -440,7 +440,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();
|