9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00

Avoid anvil too expensive (#67)

This commit is contained in:
violetc
2023-07-22 14:23:27 +08:00
parent aff95ee0dc
commit 6a675549d1
4 changed files with 55 additions and 8 deletions

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sat, 22 Jul 2023 14:16:25 +0800
Subject: [PATCH] Avoid anvil too expensive
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b9fcf49ed88c62265d9aa8926c1228b96bf314b6 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -293,7 +293,7 @@ public class AnvilMenu extends ItemCombinerMenu {
this.cost.set(this.maximumRepairCost - 1); // CraftBukkit
}
- if (this.cost.get() >= this.maximumRepairCost && !this.player.getAbilities().instabuild) { // CraftBukkit
+ if (this.cost.get() >= this.maximumRepairCost && (!top.leavesmc.leaves.LeavesConfig.avoidAnvilTooExpensive || this.cost.get() == DEFAULT_DENIED_COST) && !this.player.getAbilities().instabuild) { // CraftBukkit // Leaves - avoid anvil too expensive
itemstack1 = ItemStack.EMPTY;
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 071360899dc841f386ba536503e8b95c2b2a5214..ad0c06c1daba983dfd2660c6538dba0073f813d4 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -602,6 +602,7 @@ public final class LeavesConfig {
public static void registerCarpetRules() {
CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip));
+ CarpetRules.register(CarpetRule.of("pca", "avoidAnvilTooExpensive", avoidAnvilTooExpensive));
}
public static boolean creativeNoClip = false;