Compare commits
24 Commits
createairf
...
8c8f995b04
Author | SHA1 | Date | |
---|---|---|---|
8c8f995b04 | |||
4f78c9bd03 | |||
6032f8af2b | |||
fc5d12980f | |||
824a2cf0a3 | |||
a112b38b1c | |||
2a5f442a78 | |||
d3fea6ca2d | |||
baba04d179 | |||
4f0c236cff | |||
9f80bf51f0 | |||
b5b84d21fc | |||
212c1c11a6 | |||
908701152e | |||
ac3d2b8632 | |||
3adfd20d72 | |||
bb1a6be978 | |||
58125c04df | |||
c52aebf2a8 | |||
ccd632e0c3 | |||
956d2e6b53 | |||
ed146f441d | |||
be9a4bdd59 | |||
2c386caace |
@ -6,36 +6,62 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
env:
|
||||||
|
RUN_NUMBER: ${{ gitea.run_number }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ 17 ]
|
java: [ '17' ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout repository
|
- name: Checkout Code
|
||||||
uses: https://git.bitheaven.ru/actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: setup jdk ${{ matrix.java }}
|
- name: Setup JDK ${{ matrix.java }}
|
||||||
uses: https://git.bitheaven.ru/actions/setup-java@v1
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
|
distribution: 'oracle'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
|
|
||||||
- uses: https://git.bitheaven.ru/actions/cache@v2
|
- name: Loom Cache
|
||||||
|
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/loom-cache
|
restore-keys: "${{ runner.os }}-gradle-"
|
||||||
~/.gradle/wrapper
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
|
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
|
||||||
|
|
||||||
- name: make gradle wrapper executable
|
- name: Setup Gradle
|
||||||
run: chmod +x ./gradlew
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
with:
|
||||||
|
gradle-home-cache-cleanup: true
|
||||||
|
|
||||||
- name: build
|
- name: Validate Gradle Wrapper Integrity
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
||||||
- name: capture build artifacts
|
- name: Upload Mod JAR
|
||||||
uses: https://git.bitheaven.ru/actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Artifacts
|
name: create-air-fabric
|
||||||
path: build/libs/
|
path: build/libs/*.jar
|
||||||
|
|
||||||
|
upload-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Download build artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: create-air-fabric
|
||||||
|
|
||||||
|
- name: Make release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
name: Create Air Fabric 1.0-${{ gitea.run_number }} for 1.20.1
|
||||||
|
tag_name: createairfabric-1.0+1.20.1-${{ gitea.run_number }}
|
||||||
|
md5sum: true
|
||||||
|
sha256sum: true
|
||||||
|
files: |-
|
||||||
|
*.jar
|
||||||
|
# build/libs/**
|
||||||
|
71
build.gradle
71
build.gradle
@ -1,16 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.5-SNAPSHOT'
|
id "fabric-loom" version "1.8+"
|
||||||
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'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
base.archivesName = archives_base_name
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
String buildNumber = System.getenv("GITEA_RUN_NUMBER")
|
String buildNumber = System.getenv("RUN_NUMBER")
|
||||||
version = "${mod_version}+${minecraft_version}" + (buildNumber != null ? "-${buildNumber}" : "")
|
version = "${mod_version}+${minecraft_version}" + (buildNumber != null ? "-${buildNumber}" : "")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -20,16 +17,24 @@ repositories {
|
|||||||
// 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.shedaniel.me/" } // Cloth Config, REI
|
||||||
maven { url = "https://dvs1.progwml6.com/files/maven/" } // JEI
|
maven { url = "https://maven.blamejared.com" } // JEI
|
||||||
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings
|
maven {
|
||||||
|
name = 'ParchmentMC'
|
||||||
|
url = 'https://maven.parchmentmc.org'
|
||||||
|
}
|
||||||
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
|
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
|
||||||
maven { url = "https://api.modrinth.com/maven" } // LazyDFU
|
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://mvn.devos.one/snapshots/" } // Create, Porting Lib, Forge Tags, Milk Lib, Registrate
|
|
||||||
maven { url = "https://cursemaven.com" } // Forge Config API Port
|
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 { url = "https://jitpack.io/" } // Mixin Extras, Fabric ASM
|
maven { // Fabric ASM for Porting Lib
|
||||||
|
url = "https://jitpack.io/"
|
||||||
|
content { includeGroupAndSubgroups("com.github") }
|
||||||
|
}
|
||||||
maven { url = "https://maven.tterrag.com/" } // Flywheel
|
maven { url = "https://maven.tterrag.com/" } // Flywheel
|
||||||
|
maven { url = "https://mvn.devos.one/snapshots/" } // Create and several dependencies
|
||||||
|
maven { url = "https://mvn.devos.one/releases/" } // Porting Lib releases
|
||||||
|
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven" } // Forge Config API Port
|
||||||
|
|
||||||
exclusiveContent {
|
exclusiveContent {
|
||||||
forRepository {
|
forRepository {
|
||||||
@ -71,27 +76,30 @@ dependencies {
|
|||||||
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}")
|
||||||
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
|
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
|
||||||
|
|
||||||
// Recipe Viewers - Create Fabric supports JEI, REI, and EMI.
|
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.
|
// See root gradle.properties to choose which to use at runtime.
|
||||||
switch (recipe_viewer.toLowerCase(Locale.ROOT)) {
|
switch (recipe_viewer.toLowerCase(Locale.ROOT)) {
|
||||||
case "jei": modLocalRuntime("mezz.jei:jei-${minecraft_version}-fabric:${jei_version}"); break
|
case "jei": modLocalRuntime("mezz.jei:jei-$minecraft_version-fabric:$jei_version"); break
|
||||||
case "rei": modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}"); break
|
case "rei": modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:$rei_version"); break
|
||||||
case "emi": modLocalRuntime("dev.emi:emi:${emi_version}"); break
|
case "emi": modLocalRuntime("dev.emi:emi-fabric:$emi_version"); break
|
||||||
case "disabled": break
|
case "disabled": break
|
||||||
default: println("Unknown recipe viewer specified: ${recipe_viewer}. Must be JEI, REI, EMI, or disabled.")
|
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, String> properties = new HashMap<>()
|
Map<String, Object> properties = [
|
||||||
properties.put("version", version)
|
"version": version,
|
||||||
properties.put("fabric_loader_version", fabric_loader_version)
|
"fabric_loader_version": fabric_loader_version,
|
||||||
properties.put("fabric_api_version", fabric_api_version)
|
"fabric_api_version": fabric_api_version,
|
||||||
properties.put("create_version", "~" + create_version.split("-")[0] + "-" + create_version.split("-")[1])
|
"create_version": create_version,
|
||||||
properties.put("minecraft_version", minecraft_version)
|
"minecraft_version": minecraft_version
|
||||||
|
]
|
||||||
|
|
||||||
properties.forEach((k, v) -> inputs.property(k, v))
|
inputs.properties(properties)
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
filesMatching("fabric.mod.json") {
|
||||||
expand properties
|
expand properties
|
||||||
@ -100,7 +108,7 @@ processResources {
|
|||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
it.options.encoding = "UTF-8"
|
it.options.encoding = "UTF-8"
|
||||||
it.options.release = Integer.parseInt(sourceCompatibility)
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@ -112,20 +120,3 @@ jar {
|
|||||||
rename { "${it}_${project.archivesBaseName}"}
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure the maven publication
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
|
||||||
// Add repositories to publish to here.
|
|
||||||
// Notice: This block does NOT have the same function as the block in the top level.
|
|
||||||
// The repositories here will be used for publishing your artifact, not for
|
|
||||||
// retrieving dependencies.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -2,35 +2,35 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.20.1
|
||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.1+build.10
|
||||||
fabric_loader_version=0.14.21
|
fabric_loader_version=0.16.9
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_api_version=0.90.0+1.20.1
|
fabric_api_version=0.92.2+1.20.1
|
||||||
|
|
||||||
# Mappings
|
# Mappings
|
||||||
# https://lambdaurora.dev/tools/import_quilt.html
|
# https://lambdaurora.dev/tools/import_quilt.html
|
||||||
qm_version = 23
|
qm_version = 23
|
||||||
# https://parchmentmc.org/docs/getting-started
|
# https://parchmentmc.org/docs/getting-started
|
||||||
parchment_version = 2023.06.26
|
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
|
||||||
# https://modrinth.com/mod/create-fabric/versions
|
# https://modrinth.com/mod/create-fabric/versions
|
||||||
create_version = 0.5.1-f-build.1329+mc1.20.1
|
create_version = 0.5.1-j-build.1631+mc1.20.1
|
||||||
# https://modrinth.com/mod/thin-air/versions
|
# https://modrinth.com/mod/thin-air/versions
|
||||||
thinair_version = v8.1.5-1.20.1-Fabric
|
thinair_version = v8.1.5-1.20.1-Fabric
|
||||||
# https://modrinth.com/mod/ad-astra/versions
|
# https://modrinth.com/mod/ad-astra/versions
|
||||||
adastra_version = MxqFxL9C
|
adastra_version = Xtm1uo8F
|
||||||
botarium_version = 5a8eybLl
|
botarium_version = f3ATcSfq
|
||||||
# set to disabled to have none of them.
|
# set to disabled to have none of them.
|
||||||
recipe_viewer = disabled
|
recipe_viewer = disabled
|
||||||
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
||||||
modmenu_version = 4.1.2
|
modmenu_version = 7.2.2
|
||||||
# LazyDFU - https://modrinth.com/mod/lazydfu/versions
|
# LazyDFU - https://modrinth.com/mod/lazydfu/versions
|
||||||
lazydfu_version = 0.1.3
|
lazydfu_version = 0.1.3
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||||
networkTimeout=10000
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
@ -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,9 @@
|
|||||||
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.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||||
import ru.bitheaven.createairfabric.CreateAirFabric;
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
@ -14,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,41 @@
|
|||||||
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