Paper/nms-patches/LootEnchantFunction.patch

27 lines
1.3 KiB
Diff
Raw Normal View History

2018-08-12 10:39:51 +02:00
--- a/net/minecraft/server/LootEnchantFunction.java
+++ b/net/minecraft/server/LootEnchantFunction.java
2020-06-25 02:00:00 +02:00
@@ -37,8 +37,13 @@
2018-08-12 10:39:51 +02:00
if (entity instanceof EntityLiving) {
int i = EnchantmentManager.g((EntityLiving) entity);
+ // CraftBukkit start - use lootingModifier if set by plugin
2019-04-23 04:00:00 +02:00
+ if (loottableinfo.hasContextParameter(LootContextParameters.LOOTING_MOD)) {
+ i = loottableinfo.getContextParameter(LootContextParameters.LOOTING_MOD);
2018-08-12 10:39:51 +02:00
+ }
+ // CraftBukkit end
- if (i == 0) {
+ if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
return itemstack;
}
2020-06-25 02:00:00 +02:00
@@ -62,7 +67,7 @@
public b() {}
2019-04-23 04:00:00 +02:00
public void a(JsonObject jsonobject, LootEnchantFunction lootenchantfunction, JsonSerializationContext jsonserializationcontext) {
- super.a(jsonobject, (LootItemFunctionConditional) lootenchantfunction, jsonserializationcontext);
+ super.a(jsonobject, lootenchantfunction, jsonserializationcontext); // CraftBukkit - decompile error
jsonobject.add("count", jsonserializationcontext.serialize(lootenchantfunction.a));
2020-06-25 02:00:00 +02:00
if (lootenchantfunction.c()) {
jsonobject.add("limit", jsonserializationcontext.serialize(lootenchantfunction.b));