3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/LootEnchantFunction.patch
2020-06-25 10:00:00 +10:00

27 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/LootEnchantFunction.java
+++ b/net/minecraft/server/LootEnchantFunction.java
@@ -37,8 +37,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;
}
@@ -62,7 +67,7 @@
public b() {}
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.c()) {
jsonobject.add("limit", jsonserializationcontext.serialize(lootenchantfunction.b));