Files
Purpur/patches/server/0136-Allow-infinite-and-mending-enchantments-together.patch
William Blake Galbreath 4beb3d1768 Typo
2020-10-20 15:30:20 -05:00

51 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 13 Oct 2020 20:04:33 -0500
Subject: [PATCH] Allow infinite and mending enchantments together
diff --git a/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java b/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
index 408cfa460..3d4e34f70 100644
--- a/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
+++ b/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
@@ -23,6 +23,6 @@ public class EnchantmentInfiniteArrows extends Enchantment {
@Override
public boolean a(Enchantment enchantment) {
- return enchantment instanceof EnchantmentMending ? false : super.a(enchantment);
+ return enchantment instanceof EnchantmentMending ? net.pl3x.purpur.PurpurConfig.allowInfinityMending : super.a(enchantment); // Purpur
}
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index d33d24af6..418fc8390 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -55,8 +55,8 @@ public class PurpurConfig {
commands = new HashMap<>();
commands.put("purpur", new PurpurCommand("purpur"));
- version = getInt("config-version", 4);
- set("config-version", 4);
+ version = getInt("config-version", 5);
+ set("config-version", 5);
readConfig(PurpurConfig.class, null);
}
@@ -194,6 +194,16 @@ public class PurpurConfig {
cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
}
+ public static boolean allowInfinityMending = false;
+ private static void enchantmentSettings() {
+ if (version < 5) {
+ boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
+ set("settings.enchantment.allow-infinity-and-mending-together", oldValue);
+ set("settings.enchantment.allow-infinite-and-mending-together", null);
+ }
+ allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
+ }
+
public static boolean endermanShortHeight = false;
private static void entitySettings() {
endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);