mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Remove sign ticking (#9478)
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.
This commit is contained in:
parent
299347e31d
commit
e1adb82073
63
patches/server/Don-t-tick-signs.patch
Normal file
63
patches/server/Don-t-tick-signs.patch
Normal file
@ -0,0 +1,63 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
}
|
||||
|
@ -184,6 +184,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}));
|
||||
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
|
||||
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CeilingHangingSignBlock extends SignBlock {
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
BlockEntity itemStack = world.getBlockEntity(pos);
|
||||
if (itemStack instanceof SignBlockEntity signBlockEntity) {
|
||||
- ItemStack itemStack = player.getItemInHand(hand);
|
||||
- if (this.shouldTryToChainAnotherHangingSign(player, hit, signBlockEntity, itemStack)) {
|
||||
+ // Paper start - decompile fixes
|
||||
+ ItemStack itemStack0 = player.getItemInHand(hand);
|
||||
+ if (this.shouldTryToChainAnotherHangingSign(player, hit, signBlockEntity, itemStack0)) {
|
||||
+ // Paper end - decompile fixes
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
@ -209,6 +226,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!world.isClientSide) {
|
||||
boolean bl2 = signBlockEntity.isFacingFrontText(player);
|
||||
SignText signText = signBlockEntity.getText(bl2);
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
@@ -0,0 +0,0 @@ public class WallHangingSignBlock extends SignBlock {
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
BlockEntity itemStack = world.getBlockEntity(pos);
|
||||
if (itemStack instanceof SignBlockEntity signBlockEntity) {
|
||||
- ItemStack itemStack = player.getItemInHand(hand);
|
||||
- if (this.shouldTryToChainAnotherHangingSign(state, player, hit, signBlockEntity, itemStack)) {
|
||||
+ // Paper start - decompile fixes
|
||||
+ ItemStack itemStack0 = player.getItemInHand(hand);
|
||||
+ if (this.shouldTryToChainAnotherHangingSign(state, player, hit, signBlockEntity, itemStack0)) {
|
||||
+ // Paper end
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
|
Loading…
Reference in New Issue
Block a user