Correct nullable fall location type

This commit is contained in:
Bjarne Koll 2025-05-02 18:57:18 +02:00
parent ec421715ed
commit 51345a1cc8
No known key found for this signature in database
GPG Key ID: 9576DAF3FDDB088F

View File

@ -6,6 +6,7 @@ import io.papermc.paper.adventure.PaperAdventure;
import java.util.ArrayList;
import java.util.List;
import net.kyori.adventure.text.Component;
import net.minecraft.Optionull;
import net.minecraft.Util;
import net.minecraft.world.damagesource.FallLocation;
import org.bukkit.entity.LivingEntity;
@ -75,7 +76,7 @@ public record PaperCombatTrackerWrapper(
@Override
public FallLocationType calculateFallLocationType() {
final FallLocation fallLocation = FallLocation.getCurrentFallLocation(this.handle().mob);
return fallLocation == null ? FallLocationType.GENERIC : PaperCombatTrackerWrapper.minecraftToPaper(fallLocation);
return Optionull.map(fallLocation, PaperCombatTrackerWrapper::minecraftToPaper);
}
private static final BiMap<FallLocation, FallLocationType> FALL_LOCATION_MAPPING = Util.make(() -> {