BitHeaven fc5d12980f
Some checks failed
build / build (17) (push) Failing after 4m45s
build / upload-release (push) Has been skipped
Update Mixins from Redirect to Update Statement
2025-01-21 14:45:49 +05:00

25 lines
1.0 KiB
Java

package ru.bitheaven.createairfabric.mixin;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
import ru.bitheaven.createairfabric.CreateAirFabric;
@Mixin(DivingHelmetItem.class)
public abstract class DivingHelmetItemMixin {
/**
* Activate helmet "if in water or lava" -> "if in water or bad air or lava"
*/
@ModifyExpressionValue(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(boolean original, LivingEntity entity) {
boolean oxygen = true;
oxygen &= !original;
oxygen &= !entity.isUnderWater();
oxygen &= CreateAirFabric.isOxygen(entity);
return !oxygen;
}
}