PaperMC/patches/server/0967-Don-t-tick-signs.patch
2023-12-06 20:40:37 +01:00

63 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 12 Jul 2023 17:38:26 -0400
Subject: [PATCH] Don't tick signs
Minecraft now ticks signs in order to validate the playerWhoMayEdit field. This is a horrible idea, as this means that even waxed signs are ticked for essentially no reason. This moves the logic lazily onto the getter.
== AT ==
private net.minecraft.world.level.block.entity.SignBlockEntity playerWhoMayEdit
diff --git a/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
index cee371fde78e7e95e166b138d9437e5e8087f7c7..90fe181d035e43c4cc220cbb984f8f8c7fd29602 100644
--- a/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
@@ -154,6 +154,6 @@ public class CeilingHangingSignBlock extends SignBlock {
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> type) {
- return createTickerHelper(type, BlockEntityType.HANGING_SIGN, SignBlockEntity::tick);
+ return null; // Paper
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java
index 28cba43e42354b87e08ef87b70c274a2fdc0bb48..ade170b4c76ad4a36eb2fba831d438642c096205 100644
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
@@ -210,6 +210,6 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> type) {
- return createTickerHelper(type, BlockEntityType.SIGN, SignBlockEntity::tick);
+ return null; // Paper
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
index 32a463104593ecf00d44c449edda24a13ac8224e..484a2a689f240f1916e911459111782e91c20940 100644
--- a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
@@ -177,6 +177,6 @@ public class WallHangingSignBlock extends SignBlock {
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> type) {
- return createTickerHelper(type, BlockEntityType.HANGING_SIGN, SignBlockEntity::tick);
+ return null; // Paper
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 68f95a8eb4aa659e62394bf98ecd5f5d46879cbf..bc01970c5ef9cde4a75394d6977837e924a38463 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -365,6 +365,12 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@Nullable
public UUID getPlayerWhoMayEdit() {
+ // Paper start
+ if (this.hasLevel() && this.playerWhoMayEdit != null) {
+ // Manually invalidate the value lazily.
+ this.clearInvalidPlayerWhoMayEdit(this, this.getLevel(), this.playerWhoMayEdit);
+ }
+ // Paper end
return this.playerWhoMayEdit;
}