Fix max temper API for llama (#10823)

This commit is contained in:
Lulu13022002 2024-05-29 20:17:56 +02:00 committed by GitHub
parent 9d6f2cced7
commit 84f6e6e0b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 9 deletions

View file

@ -237,10 +237,10 @@ index d53ef42e64d87790ea86d806153f047005accb9f..57952ad65c905265799ba2d8f99cc4cf
if (angry) { if (angry) {
this.setEating(false); this.setEating(false);
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 37da58385ecf40baeb4665a0d9c262da03c01763..4fa1a12e7e5c23e1d902b59f2a315eac64134aa8 100644 index 37da58385ecf40baeb4665a0d9c262da03c01763..b6574ffbe3b9fac6ce0f4d398508c9914139f7ec 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -74,7 +74,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V @@ -74,10 +74,11 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@Nullable @Nullable
private Llama caravanHead; private Llama caravanHead;
@Nullable @Nullable
@ -249,6 +249,19 @@ index 37da58385ecf40baeb4665a0d9c262da03c01763..4fa1a12e7e5c23e1d902b59f2a315eac
public Llama(EntityType<? extends Llama> type, Level world) { public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world); super(type, world);
+ this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
}
public boolean isTraderLlama() {
@@ -318,7 +319,7 @@ 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 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 b0ac85dc3c67d2e4d70dfb09d4e8fc349aba14d2..b5cb4e4682f66ac9423af8d1547d0f1a4f9e6c5d 100644 index b0ac85dc3c67d2e4d70dfb09d4e8fc349aba14d2..b5cb4e4682f66ac9423af8d1547d0f1a4f9e6c5d 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java

View file

@ -31,10 +31,10 @@ index 85e0a68d85fe62df19ad9809b1869a3eee6d5465..bc346a6ab6aaa7de363e058d1065fd14
boolean flag1 = this.isTamed() && this.getAge() == 0 && this.canFallInLove(); boolean flag1 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 4fa1a12e7e5c23e1d902b59f2a315eac64134aa8..d4eceb535561e11f5f7ab891e81aac285f3cd828 100644 index ad54de2cf8b8be7ce072c58848ae6b79078f247c..6482cc47b7ecff784344c278ab2db9f99825a169 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -188,7 +188,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V @@ -189,7 +189,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
} }
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {

View file

@ -119,10 +119,10 @@ index 8cae4e154ca07493aba9acadd4ff7150d7ae4f67..9357cf0179d19fbdfe76413e909a99b9
} }
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index d4eceb535561e11f5f7ab891e81aac285f3cd828..1dd4290287725898ace29e46b439b55df8fdd1af 100644 index 6482cc47b7ecff784344c278ab2db9f99825a169..929fe14541b444e510b48c13aee5d69a8f58194e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -183,7 +183,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V @@ -184,7 +184,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
f = 10.0F; f = 10.0F;
if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) { if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) {
flag = true; flag = true;

View file

@ -40,7 +40,7 @@ index d93b623ce973b63d4f3a77bfe459f51af7cb3c1c..2c4553312f2f37f8613ac813708b4b95
this.path = path; this.path = path;
} }
diff --git a/src/main/java/net/minecraft/world/RandomizableContainer.java b/src/main/java/net/minecraft/world/RandomizableContainer.java diff --git a/src/main/java/net/minecraft/world/RandomizableContainer.java b/src/main/java/net/minecraft/world/RandomizableContainer.java
index 68fadc351464dde459eb4cc86660cf9add40d04e..feb35fba0c56445ee910dbe1af9b36f21b4ec480 100644 index 68fadc351464dde459eb4cc86660cf9add40d04e..a9a80f8bc4a6f250fe3c20482c395058f024fabd 100644
--- a/src/main/java/net/minecraft/world/RandomizableContainer.java --- a/src/main/java/net/minecraft/world/RandomizableContainer.java
+++ b/src/main/java/net/minecraft/world/RandomizableContainer.java +++ b/src/main/java/net/minecraft/world/RandomizableContainer.java
@@ -50,7 +50,7 @@ public interface RandomizableContainer extends Container { @@ -50,7 +50,7 @@ public interface RandomizableContainer extends Container {
@ -48,7 +48,7 @@ index 68fadc351464dde459eb4cc86660cf9add40d04e..feb35fba0c56445ee910dbe1af9b36f2
default boolean tryLoadLootTable(CompoundTag nbt) { default boolean tryLoadLootTable(CompoundTag nbt) {
if (nbt.contains("LootTable", 8)) { if (nbt.contains("LootTable", 8)) {
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable")))); - 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 (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(nbt); // Paper - LootTable API
if (nbt.contains("LootTableSeed", 4)) { if (nbt.contains("LootTableSeed", 4)) {
this.setLootTableSeed(nbt.getLong("LootTableSeed")); this.setLootTableSeed(nbt.getLong("LootTableSeed"));
@ -85,7 +85,7 @@ index c256b4307e896b3e9f0a399a93db761a8c5c593f..5eda2e858b309d2be704db1015c9c114
if (nbt.contains("Brain", 10)) { if (nbt.contains("Brain", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 7a2fefda293d72d665fee71ef29eea6bad3c0861..f6008004c00d45e5fb5b0b2133011e4d20d7a1ff 100644 index f9a8bcbd58ba450bf6f5f82ae9e08b8bec9a9c4d..d680ad6ce6cfc58753a3754a1bd5113fa9778cdc 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -645,7 +645,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -645,7 +645,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti