From bfb74bacbb4095862fa41bc56bc004976a8f6c73 Mon Sep 17 00:00:00 2001 From: gniftygnome Date: Thu, 2 Sep 2021 17:59:32 -0700 Subject: [PATCH] Allow Editable Signs to be disabled via config. Partially resolves issue #67. The first bullet point is not really addressed because the Mixin will still be applied. --- src/main/java/dev/hephaestus/tweaks/TweaksConfig.java | 4 ++++ .../java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java | 3 ++- src/main/resources/assets/tinytweaks/lang/en_us.json | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java index 8b85f61..498d773 100644 --- a/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java +++ b/src/main/java/dev/hephaestus/tweaks/TweaksConfig.java @@ -118,6 +118,10 @@ public class TweaksConfig implements ConfigData { @ConfigEntry.Gui.Tooltip public boolean automaticDoors = true; + @ConfigEntry.Category("misc") + @ConfigEntry.Gui.Tooltip + public boolean editableSigns = true; + public static class AutoPlanting { @ConfigEntry.Gui.Tooltip(count = 4) public boolean enabled = true; diff --git a/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java b/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java index dedde59..4e9e42d 100644 --- a/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java +++ b/src/main/java/dev/hephaestus/tweaks/mixin/block/EditableSigns.java @@ -1,5 +1,6 @@ package dev.hephaestus.tweaks.mixin.block; +import dev.hephaestus.tweaks.Tweaks; import net.minecraft.block.AbstractSignBlock; import net.minecraft.block.BlockState; import net.minecraft.block.SignBlock; @@ -21,7 +22,7 @@ protected EditableSigns(Settings settings, SignType type) { @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (!world.isClient && player != null) { + if (Tweaks.CONFIG.editableSigns && !world.isClient && player != null) { player.openEditSignScreen((SignBlockEntity)world.getBlockEntity(pos)); return ActionResult.SUCCESS; } diff --git a/src/main/resources/assets/tinytweaks/lang/en_us.json b/src/main/resources/assets/tinytweaks/lang/en_us.json index 3788587..1bf2940 100644 --- a/src/main/resources/assets/tinytweaks/lang/en_us.json +++ b/src/main/resources/assets/tinytweaks/lang/en_us.json @@ -121,6 +121,8 @@ "text.autoconfig.tinytweaks.option.armorStandSwap.@Tooltip": "Right click an armor stand while sneaking to swap armor with it", "text.autoconfig.tinytweaks.option.automaticDoors": "Automatic Doors", "text.autoconfig.tinytweaks.option.automaticDoors.@Tooltip": "Wooden doors open and close automatically as you walk through them", + "text.autoconfig.tinytweaks.option.editableSigns": "Editable Signs", + "text.autoconfig.tinytweaks.option.editableSigns.@Tooltip": "Right-click (use) to edit signs", "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestDropAsItems.boolean.true": "§aOn", @@ -153,6 +155,7 @@ "text.autoconfig.tinytweaks.option.blueSoulFireEffects.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.automaticDoors.boolean.true": "§aOn", + "text.autoconfig.tinytweaks.option.editableSigns.boolean.true": "§aOn", "text.autoconfig.tinytweaks.option.easyHarvestCrops.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.easyHarvestSugarcane.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.easyHarvestDropAsItems.boolean.false": "§cOff", @@ -185,5 +188,6 @@ "text.autoconfig.tinytweaks.option.blueSoulFireEffects.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.soulFireDoesMoreDamage.boolean.false": "§cOff", "text.autoconfig.tinytweaks.option.automaticDoors.boolean.false": "§cOff", + "text.autoconfig.tinytweaks.option.editableSigns.boolean.false": "§cOff", "block.cauldron.makeInfinite": "This cauldron has been blessed with the heart of the sea" } \ No newline at end of file