Paper/patches/server/0944-Expose-LootTable-of-DecoratedPot.patch
Riley Park f17519338b
Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00

51 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: FireInstall <kettnerl@hu-berlin.de>
Date: Sat, 20 Jan 2024 16:20:06 +0100
Subject: [PATCH] Expose LootTable of DecoratedPot
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java
index 6e0258d4d6a07e0f471640a9edda0adf7ef6cd9e..6015565aeedc1b2cdddcdb488f8de71bc84b61f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java
@@ -43,6 +43,39 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
return new CraftInventoryDecoratedPot(this.getTileEntity());
}
+ // Paper start - expose loot table
+ @Override
+ public void setLootTable(final org.bukkit.loot.LootTable table) {
+ this.setLootTable(table, this.getSeed());
+ }
+
+ @Override
+ public void setLootTable(org.bukkit.loot.LootTable table, long seed) {
+ net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable> key = (table == null) ? null : net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.LOOT_TABLE, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(table.getKey()));
+ this.getSnapshot().setLootTable(key, seed);
+ }
+
+ @Override
+ public org.bukkit.loot.LootTable getLootTable() {
+ if (this.getSnapshot().getLootTable() == null) {
+ return null;
+ }
+
+ net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable> key = this.getSnapshot().getLootTable();
+ return org.bukkit.Bukkit.getLootTable(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()));
+ }
+
+ @Override
+ public void setSeed(final long seed) {
+ this.getSnapshot().setLootTableSeed(seed);
+ }
+
+ @Override
+ public long getSeed() {
+ return this.getSnapshot().getLootTableSeed();
+ }
+ // Paper end - expose loot table
+
@Override
public void setSherd(Side face, Material sherd) {
Preconditions.checkArgument(face != null, "face must not be null");