40 lines
2.0 KiB
Diff
40 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Mon, 7 Jul 2025 16:30:54 +0800
|
|
Subject: [PATCH] Add config to allow infinite trade
|
|
|
|
|
|
diff --git a/net/minecraft/world/item/trading/Merchant.java b/net/minecraft/world/item/trading/Merchant.java
|
|
index 6e2fa442ddcd4ef3c4fe789b9ebac9dd409c9de7..a876335e26daec9a9a3a2f00ee5cb23cfd913aa6 100644
|
|
--- a/net/minecraft/world/item/trading/Merchant.java
|
|
+++ b/net/minecraft/world/item/trading/Merchant.java
|
|
@@ -42,7 +42,14 @@ public interface Merchant {
|
|
new SimpleMenuProvider((containerId, inventory, player1) -> new MerchantMenu(containerId, inventory, this), displayName)
|
|
);
|
|
if (optionalInt.isPresent()) {
|
|
- MerchantOffers offers = this.getOffers();
|
|
+ // Lophine start - infinite trade
|
|
+ MerchantOffers offers = this.getOffers().copy();
|
|
+ if (fun.bm.lophine.config.modules.misc.VillagerConfig.villagerInfiniteTrade) {
|
|
+ for (MerchantOffer merchantOffer : offers) {
|
|
+ merchantOffer.maxUses = 16384;
|
|
+ }
|
|
+ }
|
|
+ // Lophine end - infinite trade
|
|
if (!offers.isEmpty()) {
|
|
player.sendMerchantOffers(optionalInt.getAsInt(), offers, level, this.getVillagerXp(), this.showProgressBar(), this.canRestock());
|
|
}
|
|
diff --git a/net/minecraft/world/item/trading/MerchantOffer.java b/net/minecraft/world/item/trading/MerchantOffer.java
|
|
index 64c99df8ff305fa28c75dc03fc5ef8c61634ad84..21ec77d5167cfdf05043ea474165148fb2b0c2d9 100644
|
|
--- a/net/minecraft/world/item/trading/MerchantOffer.java
|
|
+++ b/net/minecraft/world/item/trading/MerchantOffer.java
|
|
@@ -196,7 +196,7 @@ public class MerchantOffer {
|
|
}
|
|
|
|
public boolean isOutOfStock() {
|
|
- return this.uses >= this.maxUses;
|
|
+ return (this.uses >= this.maxUses && !fun.bm.lophine.config.modules.misc.VillagerConfig.villagerInfiniteTrade); // Lophine - infinite trade
|
|
}
|
|
|
|
public void setToOutOfStock() {
|