From b584e7d956e54ef3db8fe6dde56428452d81be3d Mon Sep 17 00:00:00 2001 From: bitheaven Date: Sun, 12 Nov 2023 23:18:17 +0500 Subject: [PATCH] Rewrite for compatibility --- .../createairfabric/mixin/DivingHelmetItemMixin.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/bitheaven/createairfabric/mixin/DivingHelmetItemMixin.java b/src/main/java/ru/bitheaven/createairfabric/mixin/DivingHelmetItemMixin.java index 19b322f..94b34fd 100644 --- a/src/main/java/ru/bitheaven/createairfabric/mixin/DivingHelmetItemMixin.java +++ b/src/main/java/ru/bitheaven/createairfabric/mixin/DivingHelmetItemMixin.java @@ -6,8 +6,8 @@ import net.minecraft.world.level.material.Fluid; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import ru.bitheaven.createairfabric.CreateAirFabric; import com.simibubi.create.content.equipment.armor.DivingHelmetItem; +import ru.bitheaven.createairfabric.CreateAirFabric; @Mixin(DivingHelmetItem.class) public abstract class DivingHelmetItemMixin { @@ -17,6 +17,11 @@ public abstract class DivingHelmetItemMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isEyeInFluid(Lnet/minecraft/tags/TagKey;)Z"), method = "breatheUnderwater(Lnet/minecraft/world/entity/LivingEntity;)V") private static boolean redirectBreatheUnderwater(LivingEntity entity, TagKey fluidTagKey) { - return entity.isEyeInFluid(fluidTagKey) || CreateAirFabric.airQualityActivatesHelmet(entity); + boolean oxygen = true; + oxygen &= !entity.isEyeInFluid(fluidTagKey); + oxygen &= !entity.isUnderWater(); + oxygen &= CreateAirFabric.isOxygen(entity); + + return !oxygen; } } \ No newline at end of file