Rewrite for compatibility
This commit is contained in:
parent
570842eab6
commit
b584e7d956
|
@ -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<Fluid> fluidTagKey) {
|
||||
return entity.isEyeInFluid(fluidTagKey) || CreateAirFabric.airQualityActivatesHelmet(entity);
|
||||
boolean oxygen = true;
|
||||
oxygen &= !entity.isEyeInFluid(fluidTagKey);
|
||||
oxygen &= !entity.isUnderWater();
|
||||
oxygen &= CreateAirFabric.isOxygen(entity);
|
||||
|
||||
return !oxygen;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue