From cae5734b19b5536908ab34815426bb920486ee3e Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Wed, 29 May 2024 20:17:56 +0200
Subject: [PATCH] Fix max temper API for llama (#10823)

---
 patches/server/Missing-Entity-API.patch             | 13 +++++++++++++
 .../Validate-ResourceLocation-in-NBT-reading.patch  |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch
index b188c97f81..d356a4c0b4 100644
--- a/patches/server/Missing-Entity-API.patch
+++ b/patches/server/Missing-Entity-API.patch
@@ -249,6 +249,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      public Llama(EntityType<? extends Llama> type, Level world) {
          super(type, world);
++        this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
+     }
+ 
+     public boolean isTraderLlama() {
+@@ -0,0 +0,0 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
+ 
+     @Override
+     public int getMaxTemper() {
+-        return 30;
++        return super.getMaxTemper(); // Paper - Missing entity API; delegate to parent
+     }
+ 
+     @Override
 diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
diff --git a/patches/server/Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/Validate-ResourceLocation-in-NBT-reading.patch
index a84732b52a..77da505baf 100644
--- a/patches/server/Validate-ResourceLocation-in-NBT-reading.patch
+++ b/patches/server/Validate-ResourceLocation-in-NBT-reading.patch
@@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      default boolean tryLoadLootTable(CompoundTag nbt) {
          if (nbt.contains("LootTable", 8)) {
 -            this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
-+            this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation);
++            this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
              if (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(nbt); // Paper - LootTable API
              if (nbt.contains("LootTableSeed", 4)) {
                  this.setLootTableSeed(nbt.getLong("LootTableSeed"));