Files
Purpur/patches/server/0085-Add-LootableInventoryFirstFillEvent.patch
William Blake Galbreath 4757060211 Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
df0d7b0d Update upstream CB
6ea3c2cf [CI-SKIP] Rebuild patches
d7bed4cb Heavily optimise random block ticking (#2914)
b66d9ff8 Update upstream CB
ba71c5d6 Stop stripping private use block Unicode from signs
28d9dcfc Entity Jump API (#1587)
9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion
054e20da Clean up imports on ThrownEggHatchEvent
a8984ccb Add ThrownEggHatchEvent (#1982)
9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
2020-02-12 21:21:34 -06:00

45 lines
2.4 KiB
Diff

From f86f3611ce27bb1dafefbde47394ab728fe4519d Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 19 Oct 2019 02:43:17 -0500
Subject: [PATCH] Add LootableInventoryFirstFillEvent
---
.../paper/loottable/PaperLootableInventoryData.java | 4 ++++
.../paper/loottable/PaperTileEntityLootableInventory.java | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
index b5401eaf9..1decf0e89 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -49,6 +49,10 @@ public class PaperLootableInventoryData {
// ALWAYS process the first fill or if the feature is disabled
if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
+ // Purpur start
+ LootableInventory inventory = lootable.getAPILootableInventory();
+ if (inventory != null) new net.pl3x.purpur.event.block.LootableInventoryFirstFillEvent(player == null ? null : (Player) player.getBukkitEntity(), inventory).callEvent();
+ // Purpur end
return true;
}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
index d50410532..2f24e5a70 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
@@ -57,7 +57,10 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
if (world == null) {
return null;
}
- return (LootableInventory) getBukkitWorld().getBlockAt(MCUtil.toLocation(world, tileEntityLootable.getPosition())).getState();
+ // Purpur start
+ org.bukkit.block.BlockState state = getBukkitWorld().getBlockAt(MCUtil.toLocation(world, tileEntityLootable.getPosition())).getState();
+ return state instanceof LootableInventory ? (LootableInventory) state : null;
+ // Purpur end
}
@Override
--
2.24.0