9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-28 03:19:22 +00:00
Files
LeavesMC/patches/server/0115-Villager-infinite-discounts.patch
violetc f40d340092 1.20.6 (#216)
---------

Co-authored-by: MC_XiaoHei <xiaohei.xor7studio@foxmail.com>
Co-authored-by: Bluemangoo <chenfy2006@qq.com>
2024-05-20 23:03:56 +08:00

47 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Thu, 28 Sep 2023 17:00:22 +0800
Subject: [PATCH] Villager infinite discounts
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
index 90bdbd686560bc2987af6524bf32b0c51ef98887..8444f233b68f056fe6ef9f7f6c40e69aa8222ab7 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
@@ -15,9 +15,9 @@ public enum GossipType implements StringRepresentable {
public static final int REPUTATION_CHANGE_PER_TRADE = 2;
public final String id;
public final int weight;
- public final int max;
+ public int max; // Leaves - not final
public final int decayPerDay;
- public final int decayPerTransfer;
+ public int decayPerTransfer; // Leaves - not final
public static final Codec<GossipType> CODEC = StringRepresentable.fromEnum(GossipType::values);
private GossipType(final String key, final int multiplier, final int maxReputation, final int decay, final int shareDecrement) {
diff --git a/src/main/java/org/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java b/src/main/java/org/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..83a6ef92a097b9c8c29299db1d01ad56eeb87441
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java
@@ -0,0 +1,18 @@
+package org.leavesmc.leaves.util;
+
+import net.minecraft.world.entity.ai.gossip.GossipType;
+
+public class VillagerInfiniteDiscountHelper {
+
+ public static void doVillagerInfiniteDiscount(boolean value) {
+ if (value) {
+ GossipType.MAJOR_POSITIVE.max = 100;
+ GossipType.MAJOR_POSITIVE.decayPerTransfer = 100;
+ GossipType.MINOR_POSITIVE.max = 200;
+ } else {
+ GossipType.MAJOR_POSITIVE.max = 20;
+ GossipType.MAJOR_POSITIVE.decayPerTransfer = 20;
+ GossipType.MINOR_POSITIVE.max = 25;
+ }
+ }
+}