mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
add back portal permission bypass patch
This commit is contained in:
49
patches/server/0176-Store-placer-on-Block-when-placed.patch
Normal file
49
patches/server/0176-Store-placer-on-Block-when-placed.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
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 c3056e06a2dfb35ed8302af78525a3336433fa94..6196e3c7a6c3fb43402870b6b35d05404beee292 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -497,6 +497,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
world.isBlockPlaceCancelled = true; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||
for (BlockState blockstate : blocks) {
|
||||
blockstate.update(true, false);
|
||||
+ ((CraftBlock) blockstate.getBlock()).getNMS().getBlock().forgetPlacer(); // Purpur
|
||||
}
|
||||
world.isBlockPlaceCancelled = false; // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent
|
||||
world.preventPoiUpdated = false;
|
||||
@@ -529,6 +530,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||
block.onPlace(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 45704653310efe9cb755a644674b54b8722c2c84..1ef3b68d71c33ffb248a4b88fcfdc98a0360c4aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -437,7 +437,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();
|
||||
Reference in New Issue
Block a user