--- a/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
+++ b/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
@@ -19,12 +19,13 @@
 import net.minecraft.world.level.storage.loot.providers.number.NumberProviders;
 
 public class LootingEnchantFunction extends LootItemConditionalFunction {
+
     public static final int NO_LIMIT = 0;
     public static final Codec<LootingEnchantFunction> CODEC = RecordCodecBuilder.create((instance) -> {
-        return commonFields(instance).and(instance.group(NumberProviders.CODEC.fieldOf("count").forGetter((lootingEnchantFunction) -> {
-            return lootingEnchantFunction.value;
-        }), ExtraCodecs.strictOptionalField(Codec.INT, "limit", 0).forGetter((lootingEnchantFunction) -> {
-            return lootingEnchantFunction.limit;
+        return commonFields(instance).and(instance.group(NumberProviders.CODEC.fieldOf("count").forGetter((lootenchantfunction) -> {
+            return lootenchantfunction.value;
+        }), ExtraCodecs.strictOptionalField(Codec.INT, "limit", 0).forGetter((lootenchantfunction) -> {
+            return lootenchantfunction.limit;
         }))).apply(instance, LootingEnchantFunction::new);
     });
     private final NumberProvider value;
@@ -52,14 +53,22 @@
 
     @Override
     public ItemStack run(ItemStack stack, LootContext context) {
-        Entity entity = context.getParamOrNull(LootContextParams.KILLER_ENTITY);
+        Entity entity = (Entity) context.getParamOrNull(LootContextParams.KILLER_ENTITY);
+
         if (entity instanceof LivingEntity) {
-            int i = EnchantmentHelper.getMobLooting((LivingEntity)entity);
-            if (i == 0) {
+            int i = EnchantmentHelper.getMobLooting((LivingEntity) entity);
+            // CraftBukkit start - use lootingModifier if set by plugin
+            if (context.hasParam(LootContextParams.LOOTING_MOD)) {
+                i = context.getParamOrNull(LootContextParams.LOOTING_MOD);
+            }
+            // CraftBukkit end
+
+            if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
                 return stack;
             }
 
-            float f = (float)i * this.value.getFloat(context);
+            float f = (float) i * this.value.getFloat(context);
+
             stack.grow(Math.round(f));
             if (this.hasLimit() && stack.getCount() > this.limit) {
                 stack.setCount(this.limit);
@@ -74,6 +83,7 @@
     }
 
     public static class Builder extends LootItemConditionalFunction.Builder<LootingEnchantFunction.Builder> {
+
         private final NumberProvider count;
         private int limit = 0;
 
