Fix loot table restriction when replenish is disabled - Fixes #1860

This commit is contained in:
Aikar 2019-02-16 18:22:35 -05:00
parent 84480114eb
commit 825191f069
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,4 +1,4 @@
From 794b677388806e472929c34cf95a29abd4a35d74 Mon Sep 17 00:00:00 2001
From 2a9433a35edc1cc2055964bccbdc0614cc44713d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted"
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7c7d5595a..00f0451ef 100644
index 7c7d5595af..00f0451ef8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -270,4 +270,26 @@ public class PaperWorldConfig {
@ -43,7 +43,7 @@ index 7c7d5595a..00f0451ef 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java
new file mode 100644
index 000000000..d6fce3112
index 0000000000..d6fce3112e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java
@@ -0,0 +1,33 @@
@ -82,7 +82,7 @@ index 000000000..d6fce3112
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
new file mode 100644
index 000000000..5e637782d
index 0000000000..5e637782d5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
@@ -0,0 +1,28 @@
@ -116,7 +116,7 @@ index 000000000..5e637782d
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
new file mode 100644
index 000000000..856843fc9
index 0000000000..856843fc91
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java
@@ -0,0 +1,71 @@
@ -193,7 +193,7 @@ index 000000000..856843fc9
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
new file mode 100644
index 000000000..6e17af86a
index 0000000000..b5401eaf97
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -0,0 +1,179 @@
@ -246,8 +246,8 @@ index 000000000..6e17af86a
+ return false;
+ }
+
+ // ALWAYS process the first fill
+ if (this.lastFill == -1) {
+ // ALWAYS process the first fill or if the feature is disabled
+ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
+ return true;
+ }
+
@ -378,7 +378,7 @@ index 000000000..6e17af86a
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
new file mode 100644
index 000000000..f9fbc221b
index 0000000000..f9fbc221bd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
@@ -0,0 +1,64 @@
@ -448,7 +448,7 @@ index 000000000..f9fbc221b
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
new file mode 100644
index 000000000..d50410532
index 0000000000..d50410532c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
@@ -0,0 +1,67 @@
@ -520,7 +520,7 @@ index 000000000..d50410532
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f7a7ba412..b6356966a 100644
index e87b6b8c1a..8f86209925 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -67,6 +67,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -532,7 +532,7 @@ index f7a7ba412..b6356966a 100644
public CraftEntity getBukkitEntity() {
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index 520cca48c..e228fc853 100644
index 520cca48cc..e228fc8538 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -15,10 +15,11 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
@ -591,7 +591,7 @@ index 520cca48c..e228fc853 100644
if (this.lootTableSeed == 0L) {
diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java
index 961d9a5f9..60f0b5046 100644
index 961d9a5f99..60f0b5046a 100644
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -5,9 +5,10 @@ import javax.annotation.Nullable;
@ -647,7 +647,7 @@ index 961d9a5f9..60f0b5046 100644
if (this.h == 0L) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 8617fac6b..4f4121adc 100644
index 8617fac6b0..4f4121adca 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -61,7 +61,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@ -660,7 +660,7 @@ index 8617fac6b..4f4121adc 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index fa03d17a4..14b5be75f 100644
index fa03d17a4c..14b5be75f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -13,8 +13,9 @@ import org.bukkit.craftbukkit.CraftWorld;
@ -675,7 +675,7 @@ index fa03d17a4..14b5be75f 100644
public CraftChest(final Block block) {
super(block, TileEntityChest.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
index 7ef68bb62..daf183fb1 100644
index 7ef68bb626..daf183fb10 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@@ -1,5 +1,6 @@
@ -704,7 +704,7 @@ index 7ef68bb62..daf183fb1 100644
getSnapshot().setLootTable(key, seed);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
index 1b5b266c0..e0b99207b 100644
index 1b5b266c05..e0b99207b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
@@ -1,5 +1,6 @@
@ -724,7 +724,7 @@ index 1b5b266c0..e0b99207b 100644
public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
index 87303ecd1..6790fa2fe 100644
index 87303ecd13..6790fa2fee 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
@@ -47,7 +47,7 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
@ -737,7 +737,7 @@ index 87303ecd1..6790fa2fe 100644
getHandle().a(newKey, seed);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
index f29365c94..1937f7b9a 100644
index f29365c948..1937f7b9a2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
@@ -1,5 +1,6 @@