Compare commits
11 Commits
46a668339c
...
2889f710fb
Author | SHA1 | Date |
---|---|---|
bitheaven | 2889f710fb | |
bitheaven | 8862a20b6b | |
bitheaven | 45c772db96 | |
bitheaven | 8bed1bc0c9 | |
bitheaven | 8d34b157ca | |
bitheaven | b584e7d956 | |
bitheaven | 570842eab6 | |
bitheaven | 6915429319 | |
bitheaven | eb4bc5643b | |
bitheaven | b1dd1f0d95 | |
bitheaven | 1c5d916ff4 |
|
@ -63,6 +63,9 @@ dependencies {
|
||||||
// Thin Air
|
// Thin Air
|
||||||
modImplementation("maven.modrinth:thin-air:v8.1.3-1.20.1-Fabric")
|
modImplementation("maven.modrinth:thin-air:v8.1.3-1.20.1-Fabric")
|
||||||
|
|
||||||
|
// Ad Astra
|
||||||
|
modImplementation("curse.maven:ad-astra-635042:4774341")
|
||||||
|
|
||||||
// Development QOL
|
// Development QOL
|
||||||
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
||||||
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
|
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ru.bitheaven.createairfabric;
|
package ru.bitheaven.createairfabric;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
|
import earth.terrarium.ad_astra.common.util.OxygenUtils;
|
||||||
import fuzs.thinair.helper.AirQualityHelperImpl;
|
import fuzs.thinair.helper.AirQualityHelperImpl;
|
||||||
import io.github.fabricators_of_create.porting_lib.util.EnvExecutor;
|
import io.github.fabricators_of_create.porting_lib.util.EnvExecutor;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -23,12 +24,15 @@ public class CreateAirFabric implements ModInitializer {
|
||||||
), NAME);
|
), NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean airQualityActivatesHelmet(LivingEntity entity) {
|
public static boolean isOxygen(Entity entity) {
|
||||||
AirQualityHelperImpl air = new AirQualityHelperImpl();
|
boolean oxygen = true;
|
||||||
return !air.getAirQualityAtLocation(entity.level(), entity.getEyePosition()).canBreathe;
|
if (FabricLoader.getInstance().isModLoaded("thinair")) {
|
||||||
}
|
oxygen &= new AirQualityHelperImpl()
|
||||||
|
.getAirQualityAtLocation(entity.level(), entity.getEyePosition()).canBreathe;
|
||||||
public static ResourceLocation id(String path) {
|
}
|
||||||
return new ResourceLocation(ID, path);
|
if (FabricLoader.getInstance().isModLoaded("ad_astra")) {
|
||||||
|
oxygen &= OxygenUtils.levelHasOxygen(entity.level());
|
||||||
|
}
|
||||||
|
return oxygen;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package ru.bitheaven.createairfabric;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class CreateAirFabricMixinPlugin implements IMixinConfigPlugin {
|
||||||
|
private static final Supplier<Boolean> TRUE = () -> true;
|
||||||
|
|
||||||
|
private static final Map<String, Supplier<Boolean>> CONDITIONS = ImmutableMap.of(
|
||||||
|
"ru.bitheaven.createairfabric.mixin.DivingHelmetItemMixin",
|
||||||
|
() -> FabricLoader.getInstance().isModLoaded("thinair")
|
||||||
|
|| FabricLoader.getInstance().isModLoaded("ad_astra"),
|
||||||
|
|
||||||
|
"ru.bitheaven.createairfabric.mixin.RemainingAirOverlayMixin",
|
||||||
|
() -> FabricLoader.getInstance().isModLoaded("thinair")
|
||||||
|
|| FabricLoader.getInstance().isModLoaded("ad_astra"),
|
||||||
|
|
||||||
|
"ru.bitheaven.createairfabric.mixin.EntityOxygenSystemMixin",
|
||||||
|
() -> FabricLoader.getInstance().isModLoaded("ad_astra"),
|
||||||
|
|
||||||
|
"ru.bitheaven.createairfabric.mixin.EntityTemperatureSystemMixin",
|
||||||
|
() -> FabricLoader.getInstance().isModLoaded("ad_astra")
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||||
|
return CONDITIONS.getOrDefault(mixinClassName, TRUE).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boilerplate
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad(String mixinPackage) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRefMapperConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getMixins() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,8 +6,8 @@ import net.minecraft.world.level.material.Fluid;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
|
||||||
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||||
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
@Mixin(DivingHelmetItem.class)
|
@Mixin(DivingHelmetItem.class)
|
||||||
public abstract class DivingHelmetItemMixin {
|
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"),
|
@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")
|
method = "breatheUnderwater(Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||||
private static boolean redirectBreatheUnderwater(LivingEntity entity, TagKey<Fluid> fluidTagKey) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
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 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)
|
||||||
|
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) {
|
||||||
|
boolean createOxygen = true;
|
||||||
|
createOxygen &= !DivingHelmetItem.getWornItem(entity).isEmpty();
|
||||||
|
createOxygen &= !BacktankUtil.getAllWithAir(entity).isEmpty();
|
||||||
|
return ModUtils.armourIsOxygenated(entity) || createOxygen;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import earth.terrarium.ad_astra.common.config.AdAstraConfig;
|
||||||
|
import earth.terrarium.ad_astra.common.entity.system.EntityTemperatureSystem;
|
||||||
|
import earth.terrarium.ad_astra.common.item.armor.NetheriteSpaceSuit;
|
||||||
|
import earth.terrarium.ad_astra.common.registry.ModTags;
|
||||||
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
|
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(EntityTemperatureSystem.class)
|
||||||
|
public abstract class EntityTemperatureSystemMixin {
|
||||||
|
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/ad_astra/common/entity/system/EntityTemperatureSystem;burnEntity(Lnet/minecraft/world/entity/LivingEntity;)V"),
|
||||||
|
method = "temperatureTick(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/server/level/ServerLevel;)V")
|
||||||
|
private static void redirectTemperatureTick(LivingEntity entity) {
|
||||||
|
boolean createNetherite = true;
|
||||||
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem().isFireResistant();
|
||||||
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem().isFireResistant();
|
||||||
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModTags.HEAT_RESISTANT)
|
||||||
|
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem() instanceof NetheriteSpaceSuit
|
||||||
|
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem().isFireResistant();
|
||||||
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModTags.HEAT_RESISTANT)
|
||||||
|
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuit
|
||||||
|
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant();
|
||||||
|
|
||||||
|
if(!createNetherite) {
|
||||||
|
entity.hurt(entity.damageSources().onFire(), (float) AdAstraConfig.heatDamage);
|
||||||
|
entity.setSecondsOnFire(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,8 @@
|
||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
import net.minecraft.client.main.GameConfig;
|
import net.minecraft.client.main.GameConfig;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
|
||||||
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||||
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -9,8 +9,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
|
||||||
|
|
||||||
@Mixin(RemainingAirOverlay.class)
|
@Mixin(RemainingAirOverlay.class)
|
||||||
public class RemainingAirOverlayMixin {
|
public class RemainingAirOverlayMixin {
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +17,6 @@ public class RemainingAirOverlayMixin {
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isEyeInFluid(Lnet/minecraft/tags/TagKey;)Z"),
|
@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")
|
method = "render(Lnet/minecraft/client/gui/GuiGraphics;II)V")
|
||||||
private static boolean redirectRender(LocalPlayer player, TagKey<Fluid> fluidTagKey) {
|
private static boolean redirectRender(LocalPlayer player, TagKey<Fluid> fluidTagKey) {
|
||||||
return player.isEyeInFluid(fluidTagKey) || CreateAirFabric.airQualityActivatesHelmet(player);
|
return player.isEyeInFluid(fluidTagKey) || !CreateAirFabric.isOxygen(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "ru.bitheaven.createairfabric.mixin",
|
"package": "ru.bitheaven.createairfabric.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
|
"plugin": "ru.bitheaven.createairfabric.CreateAirFabricMixinPlugin",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"DivingHelmetItemMixin"
|
"DivingHelmetItemMixin",
|
||||||
|
"EntityOxygenSystemMixin",
|
||||||
|
"EntityTemperatureSystemMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"MinecraftMixin",
|
"MinecraftMixin",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"id": "createairfabric",
|
"id": "createairfabric",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Create Air Fabric",
|
"name": "Create Air Fabric",
|
||||||
"description": "Addon for compatibility Create and Thin Air",
|
"description": "Addon for Create that add compatibility with Thin Air, Ad Astra",
|
||||||
"authors": [
|
"authors": [
|
||||||
"BitHeaven"
|
"BitHeaven"
|
||||||
],
|
],
|
||||||
|
@ -26,7 +26,6 @@
|
||||||
"fabricloader": ">=${fabric_loader_version}",
|
"fabricloader": ">=${fabric_loader_version}",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "${minecraft_version}",
|
"minecraft": "${minecraft_version}",
|
||||||
"create": "${create_version}",
|
"create": "${create_version}"
|
||||||
"thinair": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue