3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 14:00:11 +01:00
Paper/nms-patches/LootEnchantFunction.patch
2019-04-23 12:00:00 +10:00

27 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/LootEnchantFunction.java
+++ b/net/minecraft/server/LootEnchantFunction.java
@@ -32,8 +32,13 @@
if (entity instanceof EntityLiving) {
int i = EnchantmentManager.g((EntityLiving) entity);
+ // CraftBukkit start - use lootingModifier if set by plugin
+ if (loottableinfo.hasContextParameter(LootContextParameters.LOOTING_MOD)) {
+ i = loottableinfo.getContextParameter(LootContextParameters.LOOTING_MOD);
+ }
+ // CraftBukkit end
- if (i == 0) {
+ if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
return itemstack;
}
@@ -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));