Compare commits
31 Commits
createairf
...
main
Author | SHA1 | Date |
---|---|---|
BitHeaven | b749efbbac | |
BitHeaven | 8f01df0971 | |
BitHeaven | 3683405780 | |
BitHeaven | f4625f84b3 | |
BitHeaven | 3a3b3b11fa | |
BitHeaven | 23667171ae | |
BitHeaven | 9d811a82af | |
BitHeaven | fb97097b67 | |
BitHeaven | 328ca781ff | |
BitHeaven | 429b444058 | |
BitHeaven | be08c76edf | |
BitHeaven | 7e65f5d748 | |
BitHeaven | 1079b588e5 | |
BitHeaven | 301bcad666 | |
bitheaven | 2889f710fb | |
bitheaven | 8862a20b6b | |
bitheaven | 45c772db96 | |
bitheaven | 8bed1bc0c9 | |
bitheaven | 8d34b157ca | |
bitheaven | b584e7d956 | |
bitheaven | 570842eab6 | |
bitheaven | 6915429319 | |
bitheaven | eb4bc5643b | |
bitheaven | b1dd1f0d95 | |
bitheaven | 1c5d916ff4 | |
bitheaven | 46a668339c | |
bitheaven | 58a5175ed9 | |
bitheaven | 7ccdf8d063 | |
bitheaven | 5bf98c8248 | |
bitheaven | 3e3ab91895 | |
bitheaven | 2bbd719a5f |
21
build.gradle
21
build.gradle
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.5-SNAPSHOT'
|
||||
id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
@ -31,10 +31,15 @@ repositories {
|
|||
maven { url = "https://jitpack.io/" } // Mixin Extras, Fabric ASM
|
||||
maven { url = "https://maven.tterrag.com/" } // Flywheel
|
||||
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
url 'https://www.cursemaven.com'
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
name = "Modrinth"
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup "maven.modrinth"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +61,11 @@ dependencies {
|
|||
modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}")
|
||||
|
||||
// Thin Air
|
||||
modImplementation("curse.maven:new-thin-air-878379:4611944")
|
||||
modImplementation("maven.modrinth:thin-air:${thinair_version}")
|
||||
|
||||
// Ad Astra
|
||||
modImplementation("maven.modrinth:ad-astra:${adastra_version}")
|
||||
modImplementation("maven.modrinth:botarium:${botarium_version}")
|
||||
|
||||
// Development QOL
|
||||
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
||||
|
@ -79,7 +88,7 @@ processResources {
|
|||
properties.put("version", version)
|
||||
properties.put("fabric_loader_version", fabric_loader_version)
|
||||
properties.put("fabric_api_version", fabric_api_version)
|
||||
properties.put("create_version", create_version)
|
||||
properties.put("create_version", "~" + create_version.split("-")[0] + "-" + create_version.split("-")[1])
|
||||
properties.put("minecraft_version", minecraft_version)
|
||||
|
||||
properties.forEach((k, v) -> inputs.property(k, v))
|
||||
|
|
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.10
|
||||
fabric_loader_version=0.14.24
|
||||
fabric_loader_version=0.14.21
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_api_version=0.90.0+1.20.1
|
||||
|
||||
|
@ -22,7 +22,12 @@ org.gradle.jvmargs=-Xmx1G
|
|||
|
||||
# Dependencies
|
||||
# https://modrinth.com/mod/create-fabric/versions
|
||||
create_version = 0.5.1-d-build.1161+mc1.20.1
|
||||
create_version = 0.5.1-f-build.1329+mc1.20.1
|
||||
# https://modrinth.com/mod/thin-air/versions
|
||||
thinair_version = v8.1.5-1.20.1-Fabric
|
||||
# https://modrinth.com/mod/ad-astra/versions
|
||||
adastra_version = MxqFxL9C
|
||||
botarium_version = 5a8eybLl
|
||||
# set to disabled to have none of them.
|
||||
recipe_viewer = disabled
|
||||
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package ru.bitheaven.createairfabric;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import fuzs.thinair.helper.AirHelper;
|
||||
import fuzs.thinair.helper.AirQualityLevel;
|
||||
import io.github.fabricators_of_create.porting_lib.util.EnvExecutor;
|
||||
import earth.terrarium.adastra.api.systems.OxygenApi;
|
||||
import fuzs.thinair.helper.AirQualityHelperImpl;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -18,18 +17,17 @@ public class CreateAirFabric implements ModInitializer {
|
|||
@Override
|
||||
public void onInitialize() {
|
||||
LOGGER.info("Create addon mod [{}] is loading alongside Create [{}]!", NAME, Create.VERSION);
|
||||
LOGGER.info(EnvExecutor.unsafeRunForDist(
|
||||
() -> () -> "{} is accessing Porting Lib from the client!",
|
||||
() -> () -> "{} is accessing Porting Lib from the server!"
|
||||
), NAME);
|
||||
}
|
||||
|
||||
public static boolean airQualityActivatesHelmet(LivingEntity entity) {
|
||||
final AirQualityLevel air = AirHelper.getO2LevelFromLocation(entity.getEyePosition(), entity.level()).getFirst();
|
||||
return air == AirQualityLevel.RED || air == AirQualityLevel.YELLOW;
|
||||
public static boolean isOxygen(Entity entity) {
|
||||
boolean oxygen = true;
|
||||
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 &= OxygenApi.API.hasOxygen(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.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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
import com.simibubi.create.content.equipment.armor.BacktankItem;
|
||||
import com.simibubi.create.content.equipment.armor.BacktankUtil;
|
||||
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||
|
||||
import earth.terrarium.adastra.common.items.armor.SpaceSuitItem;
|
||||
import earth.terrarium.adastra.common.systems.OxygenApiImpl;
|
||||
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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(OxygenApiImpl.class)
|
||||
public abstract class EntityOxygenSystemMixin {
|
||||
/**
|
||||
* Make air exists if Create Air
|
||||
*/
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasOxygen(Lnet/minecraft/world/entity/Entity;)Z"),
|
||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||
private boolean redirectHasOxygen(Entity entity) {
|
||||
if (!(entity instanceof LivingEntity livingEntity)) return SpaceSuitItem.hasOxygen(entity);
|
||||
boolean createOxygen = true;
|
||||
createOxygen &= !DivingHelmetItem.getWornItem(livingEntity).isEmpty();
|
||||
createOxygen &= !BacktankUtil.getAllWithAir(livingEntity).isEmpty();
|
||||
return SpaceSuitItem.hasOxygen(livingEntity) || createOxygen;
|
||||
}
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasFullSet(Lnet/minecraft/world/entity/LivingEntity;)Z"),
|
||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||
private boolean redirectHasFullSet(LivingEntity entity) {
|
||||
boolean createArmor = true;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof DivingHelmetItem;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof BacktankItem;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModItemTags.SPACE_SUITS);
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.SPACE_SUITS);
|
||||
|
||||
return SpaceSuitItem.hasFullSet(entity) || createArmor;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
import earth.terrarium.adastra.common.items.armor.NetheriteSpaceSuitItem;
|
||||
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||
import earth.terrarium.adastra.common.systems.TemperatureApiImpl;
|
||||
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(TemperatureApiImpl.class)
|
||||
public abstract class EntityTemperatureSystemMixin {
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/systems/TemperatureApiImpl;burnEntity(Lnet/minecraft/world/entity/LivingEntity;)V"),
|
||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||
private void redirectTemperatureTick(TemperatureApiImpl instance, 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(ModItemTags.HEAT_RESISTANT_ARMOR)
|
||||
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem() instanceof NetheriteSpaceSuitItem
|
||||
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem().isFireResistant();
|
||||
createNetherite &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.HEAT_RESISTANT_ARMOR)
|
||||
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuitItem
|
||||
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant();
|
||||
|
||||
if(!createNetherite) {
|
||||
entity.hurt(entity.damageSources().onFire(), 6);
|
||||
entity.setSecondsOnFire(10);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,8 @@
|
|||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.minecraft.client.main.GameConfig;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
|
||||
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
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 ru.bitheaven.createairfabric.CreateAirFabric;
|
||||
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
@Mixin(RemainingAirOverlay.class)
|
||||
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"),
|
||||
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);
|
||||
return player.isEyeInFluid(fluidTagKey) || !CreateAirFabric.isOxygen(player);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 60 KiB |
|
@ -3,8 +3,11 @@
|
|||
"minVersion": "0.8",
|
||||
"package": "ru.bitheaven.createairfabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"plugin": "ru.bitheaven.createairfabric.CreateAirFabricMixinPlugin",
|
||||
"mixins": [
|
||||
"DivingHelmetItemMixin"
|
||||
"DivingHelmetItemMixin",
|
||||
"EntityOxygenSystemMixin",
|
||||
"EntityTemperatureSystemMixin"
|
||||
],
|
||||
"client": [
|
||||
"MinecraftMixin",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"id": "createairfabric",
|
||||
"version": "${version}",
|
||||
"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": [
|
||||
"BitHeaven"
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue