mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
68 lines
3.6 KiB
Diff
68 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 24 May 2019 02:39:25 -0500
|
|
Subject: [PATCH] Signs editable on right click
|
|
|
|
|
|
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 aface9a9697095a29edaf73c9cdabc2c1414b9d7..1a04d0a601b8e481dd6e2592b849b907a5b9f63f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
|
@@ -14,6 +14,7 @@ import net.minecraft.world.item.DyeItem;
|
|
import net.minecraft.world.item.Item;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.item.Items;
|
|
+import net.minecraft.world.item.SignItem;
|
|
import net.minecraft.world.level.BlockGetter;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.LevelAccessor;
|
|
@@ -76,11 +77,11 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
|
if (world.isClientSide) {
|
|
return bl4 ? InteractionResult.SUCCESS : InteractionResult.CONSUME;
|
|
} else {
|
|
- BlockEntity bl5 = world.getBlockEntity(pos);
|
|
- if (!(bl5 instanceof SignBlockEntity)) {
|
|
+ BlockEntity blockEntity = world.getBlockEntity(pos); // Purpur - decompile fix
|
|
+ if (!(blockEntity instanceof SignBlockEntity)) { // Purpur - decompile fix
|
|
return InteractionResult.PASS;
|
|
} else {
|
|
- SignBlockEntity signBlockEntity = (SignBlockEntity)bl5;
|
|
+ SignBlockEntity signBlockEntity = (SignBlockEntity)blockEntity; // Purpur - decompile fix
|
|
boolean bl5 = signBlockEntity.hasGlowingText();
|
|
if ((!bl2 || !bl5) && (!bl3 || bl5)) {
|
|
if (bl4) {
|
|
@@ -108,6 +109,17 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
|
}
|
|
}
|
|
|
|
+ // Purpur start - right click to open sign editor
|
|
+ if (world.purpurConfig.signRightClickEdit && itemStack.getItem() instanceof SignItem &&
|
|
+ !player.isCrouching() && player.getAbilities().mayBuild &&
|
|
+ player.getBukkitEntity().hasPermission("purpur.sign.edit")) {
|
|
+ signBlockEntity.setEditable(true);
|
|
+ signBlockEntity.setAllowedPlayerEditor(player.getUUID());
|
|
+ player.openTextEdit(signBlockEntity);
|
|
+ return InteractionResult.SUCCESS;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
return signBlockEntity.executeClickCommands((ServerPlayer)player) ? InteractionResult.SUCCESS : InteractionResult.PASS;
|
|
} else {
|
|
return InteractionResult.PASS;
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 61afa4ef024e6bb9b48029aeb42977d977a41620..485925e025c5b374b9bbd183a007380eed0c663e 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -151,6 +151,11 @@ public class PurpurWorldConfig {
|
|
});
|
|
}
|
|
|
|
+ public boolean signRightClickEdit = false;
|
|
+ private void signSettings() {
|
|
+ signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
|
+ }
|
|
+
|
|
public boolean turtleEggsBreakFromExpOrbs = true;
|
|
public boolean turtleEggsBreakFromItems = true;
|
|
public boolean turtleEggsBreakFromMinecarts = true;
|