Compare commits
9 Commits
824a2cf0a3
...
main
Author | SHA1 | Date | |
---|---|---|---|
d9dded9726 | |||
9cb8f2d356 | |||
66ece416a6 | |||
5df46a0fad | |||
2b0a1a0759 | |||
8c8f995b04 | |||
4f78c9bd03 | |||
6032f8af2b | |||
fc5d12980f |
@ -19,21 +19,27 @@ jobs:
|
|||||||
- name: Setup JDK ${{ matrix.java }}
|
- name: Setup JDK ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'liberica'
|
distribution: 'oracle'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
|
cache: 'gradle'
|
||||||
|
|
||||||
- name: Cache Gradle packages
|
- name: Loom Cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: "**/.gradle/loom-cache"
|
||||||
~/.gradle/caches
|
key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}"
|
||||||
~/.gradle/wrapper
|
restore-keys: "${{ runner.os }}-gradle-"
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
||||||
restore-keys: |
|
- name: Setup Gradle
|
||||||
${{ runner.os }}-gradle-
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
with:
|
||||||
|
gradle-home-cache-cleanup: true
|
||||||
|
|
||||||
|
- name: Validate Gradle Wrapper Integrity
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew clean build --no-daemon
|
||||||
|
|
||||||
- name: Upload Mod JAR
|
- name: Upload Mod JAR
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
74
build.gradle
74
build.gradle
@ -1,14 +1,16 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "fabric-loom" version "1.8+"
|
alias libs.plugins.fabric.loom
|
||||||
id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build
|
id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
base.archivesName = archives_base_name
|
base {
|
||||||
group = project.maven_group
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
String buildNumber = System.getenv("RUN_NUMBER")
|
String buildNumber = System.getenv("RUN_NUMBER")
|
||||||
version = "${mod_version}+${minecraft_version}" + (buildNumber != null ? "-${buildNumber}" : "")
|
version = "${mod_version}+${libs.versions.minecraft.get()}" + (buildNumber != null ? "-${buildNumber}" : "")
|
||||||
|
group = project.maven_group
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Add repositories to retrieve artifacts from in here.
|
// Add repositories to retrieve artifacts from in here.
|
||||||
@ -16,16 +18,7 @@ repositories {
|
|||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
|
|
||||||
maven { url = "https://maven.blamejared.com" } // JEI
|
|
||||||
maven {
|
|
||||||
name = 'ParchmentMC'
|
|
||||||
url = 'https://maven.parchmentmc.org'
|
|
||||||
}
|
|
||||||
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
|
|
||||||
maven { url = "https://api.modrinth.com/maven" } // LazyDFU
|
|
||||||
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu
|
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu
|
||||||
maven { url = "https://cursemaven.com" } // Forge Config API Port
|
|
||||||
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
|
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
|
||||||
maven { // Fabric ASM for Porting Lib
|
maven { // Fabric ASM for Porting Lib
|
||||||
url = "https://jitpack.io/"
|
url = "https://jitpack.io/"
|
||||||
@ -49,54 +42,44 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
minecraft libs.minecraft
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
mappings loom.layered {
|
||||||
mappings(loom.layered {
|
mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2"
|
||||||
it.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${qm_version}:intermediary-v2")
|
officialMojangMappings()
|
||||||
it.parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip")
|
}
|
||||||
it.officialMojangMappings { nameSyntheticMembers = false }
|
|
||||||
})
|
modImplementation libs.fabric.loader
|
||||||
modImplementation("net.fabricmc:fabric-loader:${fabric_loader_version}")
|
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_api_version}")
|
modImplementation libs.fabric.api
|
||||||
|
|
||||||
// Create - dependencies are added transitively
|
// Create - dependencies are added transitively
|
||||||
modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}")
|
modImplementation libs.create
|
||||||
|
|
||||||
// Thin Air
|
// Thin Air
|
||||||
modImplementation("maven.modrinth:thin-air:${thinair_version}")
|
modImplementation libs.thinair
|
||||||
|
|
||||||
// Ad Astra
|
// Ad Astra
|
||||||
modImplementation("maven.modrinth:ad-astra:${adastra_version}")
|
modImplementation libs.adastra
|
||||||
modImplementation("maven.modrinth:botarium:${botarium_version}")
|
modImplementation libs.botarium
|
||||||
|
|
||||||
// Development QOL
|
// Development QOL
|
||||||
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
modLocalRuntime libs.lazydfu
|
||||||
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
|
modLocalRuntime libs.modmenu
|
||||||
|
|
||||||
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")))
|
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")))
|
||||||
|
|
||||||
// Recipe Viewers - Create Fabric supports JEI, REI, and EMI.
|
|
||||||
// See root gradle.properties to choose which to use at runtime.
|
|
||||||
switch (recipe_viewer.toLowerCase(Locale.ROOT)) {
|
|
||||||
case "jei": modLocalRuntime("mezz.jei:jei-$minecraft_version-fabric:$jei_version"); break
|
|
||||||
case "rei": modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:$rei_version"); break
|
|
||||||
case "emi": modLocalRuntime("dev.emi:emi-fabric:$emi_version"); break
|
|
||||||
case "disabled": break
|
|
||||||
default: println("Unknown recipe viewer specified: $recipe_viewer. Must be JEI, REI, EMI, or disabled.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
// require dependencies to be the version compiled against or newer
|
// require dependencies to be the version compiled against or newer
|
||||||
Map<String, Object> properties = [
|
Map<String, Object> properties = [
|
||||||
"version": version,
|
"version": version,
|
||||||
"fabric_loader_version": fabric_loader_version,
|
"fabric_loader_version": libs.versions.fabric.loader.get(),
|
||||||
"fabric_api_version": fabric_api_version,
|
"fabric_api_version": libs.versions.fabric.api.get(),
|
||||||
"create_version": create_version,
|
"create_version": libs.versions.create.get(),
|
||||||
"minecraft_version": minecraft_version
|
"minecraft_version": libs.versions.minecraft.get()
|
||||||
]
|
]
|
||||||
|
|
||||||
inputs.properties(properties)
|
inputs.properties(properties)
|
||||||
@ -112,11 +95,14 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
|
// withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from("LICENSE") {
|
from("LICENSE") {
|
||||||
rename { "${it}_${project.archivesBaseName}"}
|
rename { "${it}_${base.archivesName.get()}"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,9 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs = -Xmx1G
|
||||||
|
|
||||||
# Fabric Properties
|
|
||||||
# check these on https://modmuss50.me/fabric.html
|
|
||||||
minecraft_version=1.20.1
|
|
||||||
yarn_mappings=1.20.1+build.10
|
|
||||||
fabric_loader_version=0.16.9
|
|
||||||
# check this on https://modmuss50.me/fabric.html
|
|
||||||
fabric_api_version=0.92.2+1.20.1
|
|
||||||
|
|
||||||
# Mappings
|
|
||||||
# https://lambdaurora.dev/tools/import_quilt.html
|
|
||||||
qm_version = 23
|
|
||||||
# https://parchmentmc.org/docs/getting-started
|
|
||||||
parchment_version = 2023.09.03
|
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0
|
mod_version = 1.0
|
||||||
maven_group = ru.bitheaven
|
maven_group = ru.bitheaven
|
||||||
archives_base_name = createairfabric
|
archives_base_name = createairfabric
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies are managed at gradle/libs.versions.toml
|
||||||
# https://modrinth.com/mod/create-fabric/versions
|
|
||||||
create_version = 0.5.1-j-build.1631+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 = Xtm1uo8F
|
|
||||||
botarium_version = f3ATcSfq
|
|
||||||
# set to disabled to have none of them.
|
|
||||||
recipe_viewer = disabled
|
|
||||||
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
|
||||||
modmenu_version = 7.2.2
|
|
||||||
# LazyDFU - https://modrinth.com/mod/lazydfu/versions
|
|
||||||
lazydfu_version = 0.1.3
|
|
46
gradle/libs.versions.toml
Normal file
46
gradle/libs.versions.toml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# The latest versions are available at https://quiltmc.org/en/usage/latest-versions
|
||||||
|
[versions]
|
||||||
|
minecraft = "1.20.1"
|
||||||
|
# https://lambdaurora.dev/tools/import_quilt.html
|
||||||
|
quilt_mappings = "1.20.1+build.23"
|
||||||
|
# https://parchmentmc.org/docs/getting-started
|
||||||
|
parchment = "2023.09.03"
|
||||||
|
|
||||||
|
fabric_loom = "1.8+"
|
||||||
|
# check these on https://modmuss50.me/fabric.html
|
||||||
|
fabric_loader = "0.16.9"
|
||||||
|
fabric_api = "0.92.2+1.20.1"
|
||||||
|
|
||||||
|
# https://modrinth.com/mod/create-fabric/versions
|
||||||
|
create = "0.5.1-j-build.1631+mc1.20.1"
|
||||||
|
# https://modrinth.com/mod/thin-air/versions
|
||||||
|
thinair = "v8.1.5-1.20.1-Fabric"
|
||||||
|
# https://modrinth.com/mod/ad-astra/versions
|
||||||
|
adastra = "Xtm1uo8F"
|
||||||
|
# https://modrinth.com/mod/botarium/versions
|
||||||
|
botarium = "f3ATcSfq"
|
||||||
|
|
||||||
|
# LazyDFU - https://modrinth.com/mod/lazydfu/versions
|
||||||
|
lazydfu = "0.1.3"
|
||||||
|
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
||||||
|
modmenu = "7.2.2"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
|
||||||
|
|
||||||
|
fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" }
|
||||||
|
fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" }
|
||||||
|
|
||||||
|
create = { module = "com.simibubi.create:create-fabric-1.20.1", version.ref = "create" }
|
||||||
|
thinair = { module = "maven.modrinth:thin-air", version.ref = "thinair" }
|
||||||
|
adastra = { module = "maven.modrinth:ad-astra", version.ref = "adastra" }
|
||||||
|
botarium = { module = "maven.modrinth:botarium", version.ref = "botarium" }
|
||||||
|
|
||||||
|
lazydfu = { module = "maven.modrinth:lazydfu", version.ref = "lazydfu" }
|
||||||
|
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
|
||||||
|
|
||||||
|
# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example".
|
||||||
|
[bundles]
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
fabric_loom = { id = "fabric-loom", version.ref = "fabric_loom" }
|
@ -4,6 +4,10 @@ pluginManagement {
|
|||||||
name = 'Fabric'
|
name = 'Fabric'
|
||||||
url = 'https://maven.fabricmc.net/'
|
url = 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = 'Quilt'
|
||||||
|
url = 'https://maven.quiltmc.org/repository/release'
|
||||||
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import earth.terrarium.adastra.api.systems.OxygenApi;
|
|||||||
import fuzs.thinair.helper.AirQualityHelperImpl;
|
import fuzs.thinair.helper.AirQualityHelperImpl;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class CreateAirFabric implements ModInitializer {
|
|||||||
LOGGER.info("Create addon mod [{}] is loading alongside Create [{}]!", NAME, Create.VERSION);
|
LOGGER.info("Create addon mod [{}] is loading alongside Create [{}]!", NAME, Create.VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOxygen(Entity entity) {
|
public static boolean isOxygen(LivingEntity entity) {
|
||||||
boolean oxygen = true;
|
boolean oxygen = true;
|
||||||
if (FabricLoader.getInstance().isModLoaded("thinair")) {
|
if (FabricLoader.getInstance().isModLoaded("thinair")) {
|
||||||
oxygen &= new AirQualityHelperImpl()
|
oxygen &= new AirQualityHelperImpl()
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
import net.minecraft.tags.TagKey;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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 com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
@ -15,11 +12,11 @@ public abstract class DivingHelmetItemMixin {
|
|||||||
/**
|
/**
|
||||||
* Activate helmet "if in water or lava" -> "if in water or bad air or lava"
|
* Activate helmet "if in water or lava" -> "if in water or bad air or lava"
|
||||||
*/
|
*/
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isEyeInFluid(Lnet/minecraft/tags/TagKey;)Z"),
|
@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")
|
method = "breatheUnderwater(Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||||
private static boolean redirectBreatheUnderwater(LivingEntity entity, TagKey<Fluid> fluidTagKey) {
|
private static boolean redirectBreatheUnderwater(boolean original, LivingEntity entity) {
|
||||||
boolean oxygen = true;
|
boolean oxygen = true;
|
||||||
oxygen &= !entity.isEyeInFluid(fluidTagKey);
|
oxygen &= !original;
|
||||||
oxygen &= !entity.isUnderWater();
|
oxygen &= !entity.isUnderWater();
|
||||||
oxygen &= CreateAirFabric.isOxygen(entity);
|
oxygen &= CreateAirFabric.isOxygen(entity);
|
||||||
|
|
||||||
|
@ -1,43 +1,40 @@
|
|||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import com.simibubi.create.content.equipment.armor.BacktankItem;
|
import com.simibubi.create.content.equipment.armor.BacktankItem;
|
||||||
import com.simibubi.create.content.equipment.armor.BacktankUtil;
|
import com.simibubi.create.content.equipment.armor.BacktankUtil;
|
||||||
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
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.systems.OxygenApiImpl;
|
||||||
import earth.terrarium.adastra.common.tags.ModItemTags;
|
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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;
|
|
||||||
|
|
||||||
@Mixin(OxygenApiImpl.class)
|
@Mixin(OxygenApiImpl.class)
|
||||||
public abstract class EntityOxygenSystemMixin {
|
public abstract class EntityOxygenSystemMixin {
|
||||||
/**
|
/**
|
||||||
* Make air exists if Create Air
|
* 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"),
|
@ModifyExpressionValue(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")
|
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||||
private boolean redirectHasOxygen(Entity entity) {
|
private boolean redirectHasOxygen(boolean original, ServerLevel level, LivingEntity entity) {
|
||||||
if (!(entity instanceof LivingEntity livingEntity)) return SpaceSuitItem.hasOxygen(entity);
|
|
||||||
boolean createOxygen = true;
|
boolean createOxygen = true;
|
||||||
createOxygen &= !DivingHelmetItem.getWornItem(livingEntity).isEmpty();
|
createOxygen &= !DivingHelmetItem.getWornItem(entity).isEmpty();
|
||||||
createOxygen &= !BacktankUtil.getAllWithAir(livingEntity).isEmpty();
|
createOxygen &= !BacktankUtil.getAllWithAir(entity).isEmpty();
|
||||||
return SpaceSuitItem.hasOxygen(livingEntity) || createOxygen;
|
return original || createOxygen;
|
||||||
}
|
}
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasFullSet(Lnet/minecraft/world/entity/LivingEntity;)Z"),
|
@ModifyExpressionValue(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")
|
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||||
private boolean redirectHasFullSet(LivingEntity entity) {
|
private boolean redirectHasFullSet(boolean original, ServerLevel level, LivingEntity entity) {
|
||||||
boolean createArmor = true;
|
boolean createArmor = true;
|
||||||
createArmor &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof DivingHelmetItem;
|
createArmor &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof DivingHelmetItem;
|
||||||
createArmor &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof BacktankItem;
|
createArmor &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof BacktankItem;
|
||||||
createArmor &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModItemTags.SPACE_SUITS);
|
createArmor &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModItemTags.SPACE_SUITS);
|
||||||
createArmor &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.SPACE_SUITS);
|
createArmor &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.SPACE_SUITS);
|
||||||
|
|
||||||
return SpaceSuitItem.hasFullSet(entity) || createArmor;
|
return original || createArmor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import earth.terrarium.adastra.common.items.armor.NetheriteSpaceSuitItem;
|
import earth.terrarium.adastra.common.items.armor.NetheriteSpaceSuitItem;
|
||||||
import earth.terrarium.adastra.common.tags.ModItemTags;
|
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||||
import earth.terrarium.adastra.common.systems.TemperatureApiImpl;
|
import earth.terrarium.adastra.common.systems.TemperatureApiImpl;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
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;
|
|
||||||
|
|
||||||
@Mixin(TemperatureApiImpl.class)
|
@Mixin(TemperatureApiImpl.class)
|
||||||
public abstract class EntityTemperatureSystemMixin {
|
public abstract class EntityTemperatureSystemMixin {
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/systems/TemperatureApiImpl;burnEntity(Lnet/minecraft/world/entity/LivingEntity;)V"),
|
@ModifyExpressionValue(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/api/events/AdAstraEvents$HotTemperatureTickEvent;fire(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)Z"),
|
||||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;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) {
|
private boolean redirectTemperatureTick(boolean original, ServerLevel level, LivingEntity entity) {
|
||||||
boolean createNetherite = true;
|
boolean createNetherite = true;
|
||||||
createNetherite &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem().isFireResistant();
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem().isFireResistant();
|
||||||
createNetherite &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem().isFireResistant();
|
createNetherite &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem().isFireResistant();
|
||||||
@ -24,9 +25,6 @@ public abstract class EntityTemperatureSystemMixin {
|
|||||||
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuitItem
|
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuitItem
|
||||||
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant();
|
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant();
|
||||||
|
|
||||||
if(!createNetherite) {
|
return original && !createNetherite;
|
||||||
entity.hurt(entity.damageSources().onFire(), 6);
|
|
||||||
entity.setSecondsOnFire(10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.tags.TagKey;
|
|
||||||
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 ru.bitheaven.createairfabric.CreateAirFabric;
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
@Mixin(RemainingAirOverlay.class)
|
@Mixin(RemainingAirOverlay.class)
|
||||||
@ -14,9 +13,11 @@ public class RemainingAirOverlayMixin {
|
|||||||
/**
|
/**
|
||||||
* Activate UI "if in water or lava" -> "if in water or bad air or lava"
|
* 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"),
|
@ModifyExpressionValue(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(boolean original) {
|
||||||
return player.isEyeInFluid(fluidTagKey) || !CreateAirFabric.isOxygen(player);
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
LocalPlayer player = mc.player;
|
||||||
|
return original || !CreateAirFabric.isOxygen(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user