3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/nms-patches/LootEnchantFunction.patch

27 Zeilen
1.3 KiB
Diff

2018-08-12 10:39:51 +02:00
--- a/net/minecraft/server/LootEnchantFunction.java
+++ b/net/minecraft/server/LootEnchantFunction.java
2019-04-23 04:00:00 +02:00
@@ -32,8 +32,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;
}
2019-04-23 04:00:00 +02:00
@@ -59,7 +64,7 @@
}
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));
if (lootenchantfunction.b()) {
jsonobject.add("limit", jsonserializationcontext.serialize(lootenchantfunction.c));