Change ad-astra oxygen check to use the current location instead of the entity

This commit is contained in:
Sollace 2024-04-24 20:00:44 +01:00
parent f84ef86546
commit cda4e5b0b6
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 5 additions and 4 deletions

View file

@ -2,10 +2,11 @@ package com.minelittlepony.unicopia.compat.ad_astra;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface OxygenApi { public interface OxygenApi {
AtomicReference<OxygenApi> API = new AtomicReference<>(entity -> false); AtomicReference<OxygenApi> API = new AtomicReference<>((world, pos) -> false);
boolean hasOxygen(Entity entity); boolean hasOxygen(World world, BlockPos pos);
} }

View file

@ -200,7 +200,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
if ((RegistryUtils.isIn(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE, UTags.DimensionTypes.HAS_NO_ATMOSPHERE) if ((RegistryUtils.isIn(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE, UTags.DimensionTypes.HAS_NO_ATMOSPHERE)
|| Unicopia.getConfig().dimensionsWithoutAtmosphere.get().contains(RegistryUtils.getId(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE).toString())) || Unicopia.getConfig().dimensionsWithoutAtmosphere.get().contains(RegistryUtils.getId(entity.getWorld(), dimension, RegistryKeys.DIMENSION_TYPE).toString()))
&& !OxygenApi.API.get().hasOxygen(entity)) { && !OxygenApi.API.get().hasOxygen(entity.getWorld(), entity.getBlockPos())) {
return FlightType.NONE; return FlightType.NONE;
} }