diff --git a/src/main/java/ru/bitheaven/createairfabric/mixin/EntityOxygenSystemMixin.java b/src/main/java/ru/bitheaven/createairfabric/mixin/EntityOxygenSystemMixin.java index 8954ee7..c89197c 100644 --- a/src/main/java/ru/bitheaven/createairfabric/mixin/EntityOxygenSystemMixin.java +++ b/src/main/java/ru/bitheaven/createairfabric/mixin/EntityOxygenSystemMixin.java @@ -2,24 +2,26 @@ package ru.bitheaven.createairfabric.mixin; import com.simibubi.create.content.equipment.armor.BacktankUtil; import com.simibubi.create.content.equipment.armor.DivingHelmetItem; -import earth.terrarium.ad_astra.common.entity.system.EntityOxygenSystem; -import earth.terrarium.ad_astra.common.util.ModUtils; + +import earth.terrarium.adastra.common.items.armor.SpaceSuitItem; +import earth.terrarium.adastra.common.systems.OxygenApiImpl; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(EntityOxygenSystem.class) +@Mixin(OxygenApiImpl.class) public abstract class EntityOxygenSystemMixin { /** * Make air exists if Create Air */ - @Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/ad_astra/common/util/ModUtils;armourIsOxygenated(Lnet/minecraft/world/entity/LivingEntity;)Z"), - method = "oxygenTick(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/server/level/ServerLevel;)V") - private static boolean redirectOxygenTick(LivingEntity entity) { + @Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasOxygen(Lnet/minecraft/world/entity/Entity;)Z"), + method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V") + private boolean redirectOxygenTick(Entity entity) { boolean createOxygen = true; createOxygen &= !DivingHelmetItem.getWornItem(entity).isEmpty(); - createOxygen &= !BacktankUtil.getAllWithAir(entity).isEmpty(); - return ModUtils.armourIsOxygenated(entity) || createOxygen; + createOxygen &= !BacktankUtil.getAllWithAir((LivingEntity) entity).isEmpty(); + return SpaceSuitItem.hasOxygen(entity) || createOxygen; } }