summaryrefslogtreecommitdiffstats
path: root/nms-patches/LootEnchantFunction.patch
diff options
context:
space:
mode:
authorSenmori <thesenmori@gmail.com>2018-08-12 18:39:51 +1000
committermd_5 <git@md-5.net>2018-08-12 18:40:03 +1000
commitc0df4b82d380bea4fd66cc887a1476468e2301c4 (patch)
tree0fa0d8db07d29c0f1c53bb9a70568eb42e9a9c7d /nms-patches/LootEnchantFunction.patch
parent15da7067067a0786d221f2ad3cd060acd4dd3431 (diff)
downloadcraftbukkit-c0df4b82d380bea4fd66cc887a1476468e2301c4.tar
craftbukkit-c0df4b82d380bea4fd66cc887a1476468e2301c4.tar.gz
craftbukkit-c0df4b82d380bea4fd66cc887a1476468e2301c4.tar.lz
craftbukkit-c0df4b82d380bea4fd66cc887a1476468e2301c4.tar.xz
craftbukkit-c0df4b82d380bea4fd66cc887a1476468e2301c4.zip
SPIGOT-1936: LootTable API
Diffstat (limited to 'nms-patches/LootEnchantFunction.patch')
-rw-r--r--nms-patches/LootEnchantFunction.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/nms-patches/LootEnchantFunction.patch b/nms-patches/LootEnchantFunction.patch
new file mode 100644
index 00000000..af3c6d1c
--- /dev/null
+++ b/nms-patches/LootEnchantFunction.patch
@@ -0,0 +1,26 @@
+--- a/net/minecraft/server/LootEnchantFunction.java
++++ b/net/minecraft/server/LootEnchantFunction.java
+@@ -21,8 +21,13 @@
+
+ if (entity instanceof EntityLiving) {
+ int i = EnchantmentManager.g((EntityLiving) entity);
++ // CraftBukkit start - use lootingModifier if set by plugin
++ if (loottableinfo.lootingMod > org.bukkit.loot.LootContext.DEFAULT_LOOT_MODIFIER) {
++ i = loottableinfo.lootingMod;
++ }
++ // CraftBukkit end
+
+- if (i == 0) {
++ if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
+ return itemstack;
+ }
+
+@@ -57,7 +62,7 @@
+ return new LootEnchantFunction(alootitemcondition, (LootValueBounds) ChatDeserializer.a(jsonobject, "count", jsondeserializationcontext, LootValueBounds.class), i);
+ }
+
+- public LootItemFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) {
++ public LootEnchantFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) { // CraftBukkit - decompile error
+ return this.a(jsonobject, jsondeserializationcontext, alootitemcondition);
+ }
+ }