Right click to open sign editor

This commit is contained in:
William Blake Galbreath
2019-05-24 03:29:59 -05:00
parent d4c0fe9190
commit c9747fbda3
2 changed files with 56 additions and 1 deletions

View File

@@ -88,8 +88,13 @@ World Settings
World settings are on a per-world basis. The child-node `default` is used for all worlds that do not have their own specific settings.
editable-signs
~~~~~~~~~~~~~~
* **default**: true
* **description**: Ability to edit signs by right clicking them with another sign in hand
campfire-obeys-gravity
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~
* **default**: true
* **description**: When true, campfires will fall to the ground (like anvils do) instead of floating in the air

View File

@@ -0,0 +1,50 @@
From fe717237720589ce53c2584f68295a06da571d5a 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] Right click to open sign editor
---
src/main/java/net/minecraft/server/BlockSign.java | 10 ++++++++++
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java
index b6d7689d5..746709025 100644
--- a/src/main/java/net/minecraft/server/BlockSign.java
+++ b/src/main/java/net/minecraft/server/BlockSign.java
@@ -52,6 +52,16 @@ public abstract class BlockSign extends BlockTileEntity implements IBlockWaterlo
}
}
+ // Purpur start - right click to open sign editor
+ if (world.purpurConfig.editableSigns && itemstack.getItem() instanceof ItemSign &&
+ !entityhuman.isSneaking() && entityhuman.abilities.mayBuild) {
+ tileentitysign.isEditable = true;
+ tileentitysign.a(entityhuman);
+ entityhuman.openSign(tileentitysign);
+ return true;
+ }
+ // Purpur end
+
return tileentitysign.b(entityhuman);
} else {
return false;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index e598099dd..b0d7c6bd2 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -61,6 +61,11 @@ public class PurpurWorldConfig {
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
}
+ public boolean editableSigns = true;
+ private void editableSigns() {
+ editableSigns = getBoolean("editable-signs", editableSigns);
+ }
+
public boolean campfireObeysGravity = true;
private void campfireObeysGravity() {
campfireObeysGravity = getBoolean("campfire-obeys-gravity", campfireObeysGravity);
--
2.20.1