summaryrefslogtreecommitdiffstats
path: root/nms-patches/LootEnchantFunction.patch
blob: af3c6d1cd4021e69812bf09a8f16d80cf1b5904c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
         }
     }