Apply nullable annotations to LootingLevelEvent (#8422)

This commit is contained in:
Brennan Ward authored and GitHub committed 2022-02-22 14:20:29 -08:00
1 parent a9237cff75
commit 512d4d7271
2 files changed
+8 -3

No files matched your search

@@ -347,7 +347,7 @@ public class ForgeHooks
return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.getDistance(), event.getDamageMultiplier()});
}
public static int getLootingLevel(Entity target, @Nullable Entity killer, DamageSource cause)
public static int getLootingLevel(Entity target, @Nullable Entity killer, @Nullable DamageSource cause)
{
int looting = 0;
if (killer instanceof LivingEntity)
@@ -357,7 +357,7 @@ public class ForgeHooks
return looting;
}
public static int getLootingLevel(LivingEntity target, DamageSource cause, int level)
public static int getLootingLevel(LivingEntity target, @Nullable DamageSource cause, int level)
{
LootingLevelEvent event = new LootingLevelEvent(target, cause, level);
MinecraftForge.EVENT_BUS.post(event);
@@ -20,20 +20,25 @@
package net.minecraftforge.event.entity.living;
import net.minecraft.world.entity.LivingEntity;
import javax.annotation.Nullable;
import net.minecraft.world.damagesource.DamageSource;
public class LootingLevelEvent extends LivingEvent {
@Nullable
private final DamageSource damageSource;
private int lootingLevel;
public LootingLevelEvent(LivingEntity entity, DamageSource damageSource, int lootingLevel) {
public LootingLevelEvent(LivingEntity entity, @Nullable DamageSource damageSource, int lootingLevel) {
super(entity);
this.damageSource = damageSource;
this.lootingLevel = lootingLevel;
}
@Nullable
public DamageSource getDamageSource() {
return damageSource;
}