9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00
Files
LeavesMC/patches/server/0118-Villager-infinite-discounts.patch
2024-01-10 13:32:42 +08:00

47 lines
2.1 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 8c942c21dc3aebcd2fc89b5bde92c73a95bdc3e3..55b4386fc57286548161f9ee91e19e22e35ba3c9 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(String key, int multiplier, int maxReputation, int decay, int shareDecrement) {
diff --git a/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java b/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..a5063fdcc8b5bf009994bf4134a56390141e69c2
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java
@@ -0,0 +1,18 @@
+package top.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;
+ }
+ }
+}