From 1dbdbbed49fec30b440a243f75998c3936637376 Mon Sep 17 00:00:00 2001 From: Miles Holder Date: Sun, 17 Dec 2023 09:29:48 +1100 Subject: [PATCH] #1238: Remove unnecessary sign ticking --- .../net/minecraft/world/level/block/BlockSign.patch | 8 ++++++++ .../world/level/block/CeilingHangingSignBlock.patch | 10 ++++++++++ .../world/level/block/WallHangingSignBlock.patch | 10 ++++++++++ .../world/level/block/entity/TileEntitySign.patch | 12 +++++++++++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 nms-patches/net/minecraft/world/level/block/CeilingHangingSignBlock.patch create mode 100644 nms-patches/net/minecraft/world/level/block/WallHangingSignBlock.patch diff --git a/nms-patches/net/minecraft/world/level/block/BlockSign.patch b/nms-patches/net/minecraft/world/level/block/BlockSign.patch index 22ba64930..3affa3a94 100644 --- a/nms-patches/net/minecraft/world/level/block/BlockSign.patch +++ b/nms-patches/net/minecraft/world/level/block/BlockSign.patch @@ -25,3 +25,11 @@ tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID()); entityhuman.openTextEdit(tileentitysign, flag); } +@@ -184,6 +193,6 @@ + @Nullable + @Override + public BlockEntityTicker getTicker(World world, IBlockData iblockdata, TileEntityTypes tileentitytypes) { +- return createTickerHelper(tileentitytypes, TileEntityTypes.SIGN, TileEntitySign::tick); ++ return null; // Craftbukkit - remove unnecessary sign ticking + } + } diff --git a/nms-patches/net/minecraft/world/level/block/CeilingHangingSignBlock.patch b/nms-patches/net/minecraft/world/level/block/CeilingHangingSignBlock.patch new file mode 100644 index 000000000..2cffc8787 --- /dev/null +++ b/nms-patches/net/minecraft/world/level/block/CeilingHangingSignBlock.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/CeilingHangingSignBlock.java ++++ b/net/minecraft/world/level/block/CeilingHangingSignBlock.java +@@ -161,6 +161,6 @@ + @Nullable + @Override + public BlockEntityTicker getTicker(World world, IBlockData iblockdata, TileEntityTypes tileentitytypes) { +- return createTickerHelper(tileentitytypes, TileEntityTypes.HANGING_SIGN, TileEntitySign::tick); ++ return null; // Craftbukkit - remove unnecessary sign ticking + } + } diff --git a/nms-patches/net/minecraft/world/level/block/WallHangingSignBlock.patch b/nms-patches/net/minecraft/world/level/block/WallHangingSignBlock.patch new file mode 100644 index 000000000..8195d1064 --- /dev/null +++ b/nms-patches/net/minecraft/world/level/block/WallHangingSignBlock.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/WallHangingSignBlock.java ++++ b/net/minecraft/world/level/block/WallHangingSignBlock.java +@@ -186,6 +186,6 @@ + @Nullable + @Override + public BlockEntityTicker getTicker(World world, IBlockData iblockdata, TileEntityTypes tileentitytypes) { +- return createTickerHelper(tileentitytypes, TileEntityTypes.HANGING_SIGN, TileEntitySign::tick); ++ return null; // Craftbukkit - remove unnecessary sign ticking + } + } diff --git a/nms-patches/net/minecraft/world/level/block/entity/TileEntitySign.patch b/nms-patches/net/minecraft/world/level/block/entity/TileEntitySign.patch index 14630f0b2..84e9fa653 100644 --- a/nms-patches/net/minecraft/world/level/block/entity/TileEntitySign.patch +++ b/nms-patches/net/minecraft/world/level/block/entity/TileEntitySign.patch @@ -132,7 +132,17 @@ } @Override -@@ -281,7 +342,7 @@ +@@ -276,12 +337,17 @@ + + @Nullable + public UUID getPlayerWhoMayEdit() { ++ // CraftBukkit start - unnecessary sign ticking removed, so do this lazily ++ if (this.level != null && this.playerWhoMayEdit != null) { ++ clearInvalidPlayerWhoMayEdit(this, this.level, this.playerWhoMayEdit); ++ } ++ // CraftBukkit end + return this.playerWhoMayEdit; + } private void markUpdated() { this.setChanged();