3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00

Fixes for loot tables (#9818)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-10-10 10:35:49 -07:00 committet von GitHub
Ursprung a2ba45239c
Commit e87240b674
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -67,6 +67,22 @@ index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd
this.storageAccess = chunkIoWorker;
this.registryAccess = registryManager;
this.structureTemplateManager = structureTemplateManager;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
index 6ab2fd523b7f4e5cacef4ebb95f6812f391985d1..85133c388eff009ea1ffa391824b6556f7bf2014 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
@@ -174,4 +174,11 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
org.bukkit.loot.LootTable table = (org.bukkit.loot.LootTable) obj;
return table.getKey().equals(this.getKey());
}
+
+ // Paper start - satisfy equals/hashCode contract
+ @Override
+ public int hashCode() {
+ return java.util.Objects.hash(key);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2d5627f5dc48c0d51464452907b50bbeb069e67c..f890e0e8ae52965f671fe82911b006a61a33a86b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 10 Oct 2023 10:17:43 -0700
Subject: [PATCH] Use correct variable for initializing CraftLootTable
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
index ac4de8a082b495d945723d6062d9eacaa9add2bb..08f5239d5eea9133340ec9e1a3a7d8d5e792ced0 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
@@ -101,7 +101,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
});
// CraftBukkit start
map1.forEach((key, lootTable) -> {
- if (object instanceof LootTable table) {
+ if (lootTable instanceof LootTable table) { // Paper - use correct variable
table.craftLootTable = new CraftLootTable(CraftNamespacedKey.fromMinecraft(key.location()), table);
}
});