From cda4e5b0b614fdeba90c6ea156a79fc74cb8e7be Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 24 Apr 2024 20:00:44 +0100 Subject: [PATCH] Change ad-astra oxygen check to use the current location instead of the entity --- .../minelittlepony/unicopia/compat/ad_astra/OxygenApi.java | 7 ++++--- .../unicopia/entity/player/PlayerPhysics.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/compat/ad_astra/OxygenApi.java b/src/main/java/com/minelittlepony/unicopia/compat/ad_astra/OxygenApi.java index 7a216d4c..abc635e2 100644 --- a/src/main/java/com/minelittlepony/unicopia/compat/ad_astra/OxygenApi.java +++ b/src/main/java/com/minelittlepony/unicopia/compat/ad_astra/OxygenApi.java @@ -2,10 +2,11 @@ package com.minelittlepony.unicopia.compat.ad_astra; 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 { - AtomicReference API = new AtomicReference<>(entity -> false); + AtomicReference API = new AtomicReference<>((world, pos) -> false); - boolean hasOxygen(Entity entity); + boolean hasOxygen(World world, BlockPos pos); } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index e6898304..699a2e95 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -200,7 +200,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab 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())) - && !OxygenApi.API.get().hasOxygen(entity)) { + && !OxygenApi.API.get().hasOxygen(entity.getWorld(), entity.getBlockPos())) { return FlightType.NONE; }