Add an option to fix MC-3304 (projectile looting)

This commit is contained in:
MelnCat
2025-01-12 16:47:29 -08:00
committed by granny
parent d72e7f1930
commit b3994f8939
6 changed files with 61 additions and 90 deletions

View File

@@ -0,0 +1,14 @@
--- a/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java
+++ b/net/minecraft/world/level/storage/loot/functions/EnchantedCountIncreaseFunction.java
@@ -66,6 +_,11 @@
Entity entity = context.getOptionalParameter(LootContextParams.ATTACKING_ENTITY);
if (entity instanceof LivingEntity livingEntity) {
int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(this.enchantment, livingEntity);
+ // Purpur start - Add an option to fix MC-3304 projectile looting
+ if (org.purpurmc.purpur.PurpurConfig.fixProjectileLootingTransfer && context.getOptionalParameter(LootContextParams.DIRECT_ATTACKING_ENTITY) instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) {
+ enchantmentLevel = arrow.actualEnchantments.getLevel(this.enchantment);
+ }
+ // Purpur end - Add an option to fix MC-3304 projectile looting
if (enchantmentLevel == 0) {
return stack;
}