mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
41 lines
3.2 KiB
Diff
41 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Sun, 9 Jul 2023 14:50:57 +0800
|
|
Subject: [PATCH] Sync with Gale's Optimize-villager-data-storage.patch
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
|
index 753587e4d9582605951461f2bea37aff3bf28fcd..77fb2b0c4b9defaa16a2f89b194e8f5084ade12c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
|
@@ -22,6 +22,7 @@ public class TradeWithVillager extends Behavior<Villager> {
|
|
private static final float SPEED_MODIFIER = 0.5F;
|
|
// Gale start - optimize villager data storage
|
|
private static final Item[] WHEAT_SINGLETON_ARRAY = {Items.WHEAT};
|
|
+ private static final Item[] NETHER_WART_SINGLETON_ARRAY = {Items.NETHER_WART}; // Leaf - sync with Gale's Optimize-villager-data-storage.patch
|
|
private @NotNull Item @Nullable [] trades = null;
|
|
// Gale end - optimize villager data storage
|
|
|
|
@@ -67,7 +68,7 @@ public class TradeWithVillager extends Behavior<Villager> {
|
|
|
|
// Purpur start
|
|
if (world.purpurConfig.villagerClericsFarmWarts && world.purpurConfig.villagerClericFarmersThrowWarts && entity.getVillagerData().getProfession() == VillagerProfession.CLERIC && entity.getInventory().countItem(Items.NETHER_WART) > Items.NETHER_WART.getMaxStackSize() / 2) {
|
|
- throwHalfStack(entity, ImmutableSet.of(Items.NETHER_WART), villager);
|
|
+ throwHalfStack(entity, NETHER_WART_SINGLETON_ARRAY, villager); // Leaf - sync with Gale's Optimize-villager-data-storage.patch
|
|
}
|
|
// Purpur end
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
|
|
index 8f36f113e8eb3236ce53ad9cce320c3d6253d248..ebe79d9ad2934b53085c8a720fdfca0a6eda05ca 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/VillagerProfession.java
|
|
@@ -31,7 +31,7 @@ public record VillagerProfession(
|
|
public static final VillagerProfession ARMORER = register("armorer", PoiTypes.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER);
|
|
public static final VillagerProfession BUTCHER = register("butcher", PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER);
|
|
public static final VillagerProfession CARTOGRAPHER = register("cartographer", PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
|
|
- public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur
|
|
+ public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, new Item[] {Items.NETHER_WART}, Blocks.SOUL_SAND, SoundEvents.VILLAGER_WORK_CLERIC); // Purpur // Leaf - sync with Gale's Optimize-villager-data-storage.patch
|
|
public static final VillagerProfession FARMER = register(
|
|
"farmer",
|
|
PoiTypes.FARMER,
|