Compare commits
4 Commits
82e8b27221
...
createairf
Author | SHA1 | Date | |
---|---|---|---|
2bbd719a5f | |||
44b85603da | |||
36942712f1 | |||
fd5ef6c9f7 |
@ -25,7 +25,7 @@ public class CreateAirFabric implements ModInitializer {
|
||||
}
|
||||
|
||||
public static boolean airQualityActivatesHelmet(LivingEntity entity) {
|
||||
final var air = AirHelper.getO2LevelFromLocation(entity.getEyePosition(), entity.level()).getFirst();
|
||||
final AirQualityLevel air = AirHelper.getO2LevelFromLocation(entity.getEyePosition(), entity.level()).getFirst();
|
||||
return air == AirQualityLevel.RED || air == AirQualityLevel.YELLOW;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,14 @@
|
||||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
import fuzs.thinair.helper.AirHelper;
|
||||
import fuzs.thinair.helper.AirQualityLevel;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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 net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
@Mixin(DivingHelmetItem.class)
|
||||
public abstract class DivingHelmetItemMixin {
|
||||
/**
|
||||
|
@ -0,0 +1,24 @@
|
||||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
|
||||
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||
import net.minecraft.tags.TagKey;
|
||||
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 net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
@Mixin(RemainingAirOverlay.class)
|
||||
public class RemainingAirOverlayMixin {
|
||||
/**
|
||||
* Activate UI "if in water or lava" -> "if in water or bad air or lava"
|
||||
*/
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isEyeInFluid(Lnet/minecraft/tags/TagKey;)Z"),
|
||||
method = "render(Lnet/minecraft/client/gui/GuiGraphics;II)V")
|
||||
private static boolean redirectRender(LocalPlayer player, TagKey<Fluid> fluidTagKey) {
|
||||
return player.isEyeInFluid(fluidTagKey) || CreateAirFabric.airQualityActivatesHelmet(player);
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 60 KiB |
@ -7,7 +7,8 @@
|
||||
"DivingHelmetItemMixin"
|
||||
],
|
||||
"client": [
|
||||
"MinecraftMixin"
|
||||
"MinecraftMixin",
|
||||
"RemainingAirOverlayMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Reference in New Issue
Block a user