mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Properly check if a loot table exists (#10190)
This commit is contained in:
parent
adf45d523a
commit
cc0082f248
1 changed files with 2 additions and 4 deletions
|
@ -94,10 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- return new CraftLootTable(key, registry.getLootTable(CraftNamespacedKey.toMinecraft(key)));
|
||||
+ // Paper start - honor method contract
|
||||
+ final ResourceLocation lootTableKey = CraftNamespacedKey.toMinecraft(key);
|
||||
+ if (registry.getLootTable(lootTableKey) == net.minecraft.world.level.storage.loot.LootTable.EMPTY) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return new CraftLootTable(key, registry.getLootTable(lootTableKey));
|
||||
+ final Optional<net.minecraft.world.level.storage.loot.LootTable> table = registry.getElementOptional(net.minecraft.world.level.storage.loot.LootDataType.TABLE, lootTableKey);
|
||||
+ return table.map(lootTable -> new CraftLootTable(key, lootTable)).orElse(null);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue