Add Ad Astra

This commit is contained in:
bitheaven 2023-11-12 23:17:12 +05:00
parent 1c5d916ff4
commit b1dd1f0d95
1 changed files with 13 additions and 9 deletions

View File

@ -1,11 +1,12 @@
package ru.bitheaven.createairfabric; package ru.bitheaven.createairfabric;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import earth.terrarium.ad_astra.common.util.OxygenUtils;
import fuzs.thinair.helper.AirQualityHelperImpl; import fuzs.thinair.helper.AirQualityHelperImpl;
import io.github.fabricators_of_create.porting_lib.util.EnvExecutor; import io.github.fabricators_of_create.porting_lib.util.EnvExecutor;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.resources.ResourceLocation; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Entity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -23,12 +24,15 @@ public class CreateAirFabric implements ModInitializer {
), NAME); ), NAME);
} }
public static boolean airQualityActivatesHelmet(LivingEntity entity) { public static boolean isOxygen(Entity entity) {
AirQualityHelperImpl air = new AirQualityHelperImpl(); boolean oxygen = true;
return !air.getAirQualityAtLocation(entity.level(), entity.getEyePosition()).canBreathe; if (FabricLoader.getInstance().isModLoaded("thinair")) {
oxygen &= new AirQualityHelperImpl()
.getAirQualityAtLocation(entity.level(), entity.getEyePosition()).canBreathe;
} }
if (FabricLoader.getInstance().isModLoaded("ad_astra")) {
public static ResourceLocation id(String path) { oxygen &= OxygenUtils.levelHasOxygen(entity.level());
return new ResourceLocation(ID, path); }
return oxygen;
} }
} }