Skip to content

Commit e9aa88c

Browse files
committed
Fix Clover's favor helper trying to read a player-only attribute on any LivingEntity
1 parent 91ed3f6 commit e9aa88c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/de/dafuqs/spectrum/helpers/enchantments/CloversFavorHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import de.dafuqs.additionalentityattributes.*;
44
import net.minecraft.entity.*;
5+
import net.minecraft.entity.player.*;
56
import org.jetbrains.annotations.*;
67

78
public class CloversFavorHelper {
89

910
// TODO: give this enchantment AdditionalEntityAttributes.BONUS_RARE_LOOT_ROLLS 1 for level 1, 4 for level 2, ...
1011
public static float rollChance(float baseChance, @Nullable Entity entity) {
11-
if (entity instanceof LivingEntity livingEntity) {
12-
float rareLootLevel = (float) livingEntity.getAttributeValue(AdditionalEntityAttributes.BONUS_RARE_LOOT_ROLLS);
12+
if (entity instanceof PlayerEntity player) {
13+
float rareLootLevel = (float) player.getAttributeValue(AdditionalEntityAttributes.BONUS_RARE_LOOT_ROLLS);
1314
if (rareLootLevel > 0) {
1415
return baseChance * rareLootLevel;
1516
}

0 commit comments

Comments
 (0)