Compare commits
63 Commits
82e8b27221
...
main
Author | SHA1 | Date | |
---|---|---|---|
d9dded9726 | |||
9cb8f2d356 | |||
66ece416a6 | |||
5df46a0fad | |||
2b0a1a0759 | |||
8c8f995b04 | |||
4f78c9bd03 | |||
6032f8af2b | |||
fc5d12980f | |||
824a2cf0a3 | |||
a112b38b1c | |||
2a5f442a78 | |||
d3fea6ca2d | |||
baba04d179 | |||
4f0c236cff | |||
9f80bf51f0 | |||
b5b84d21fc | |||
212c1c11a6 | |||
908701152e | |||
ac3d2b8632 | |||
3adfd20d72 | |||
bb1a6be978 | |||
58125c04df | |||
c52aebf2a8 | |||
ccd632e0c3 | |||
956d2e6b53 | |||
ed146f441d | |||
be9a4bdd59 | |||
2c386caace | |||
b749efbbac | |||
8f01df0971 | |||
3683405780 | |||
f4625f84b3 | |||
3a3b3b11fa | |||
23667171ae | |||
9d811a82af | |||
fb97097b67 | |||
328ca781ff | |||
429b444058 | |||
be08c76edf | |||
7e65f5d748 | |||
1079b588e5 | |||
301bcad666 | |||
2889f710fb | |||
8862a20b6b | |||
45c772db96 | |||
8bed1bc0c9 | |||
8d34b157ca | |||
b584e7d956 | |||
570842eab6 | |||
6915429319 | |||
eb4bc5643b | |||
b1dd1f0d95 | |||
1c5d916ff4 | |||
46a668339c | |||
58a5175ed9 | |||
7ccdf8d063 | |||
5bf98c8248 | |||
3e3ab91895 | |||
2bbd719a5f | |||
44b85603da | |||
36942712f1 | |||
fd5ef6c9f7 |
@ -6,36 +6,63 @@ 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 }}
|
||||||
|
cache: 'gradle'
|
||||||
|
|
||||||
- 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
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: capture build artifacts
|
|
||||||
uses: https://git.bitheaven.ru/actions/upload-artifact@v2
|
|
||||||
with:
|
with:
|
||||||
name: Artifacts
|
gradle-home-cache-cleanup: true
|
||||||
path: build/libs/
|
|
||||||
|
- name: Validate Gradle Wrapper Integrity
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew clean build --no-daemon
|
||||||
|
|
||||||
|
- name: Upload Mod JAR
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: create-air-fabric
|
||||||
|
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/**
|
||||||
|
122
build.gradle
122
build.gradle
@ -1,88 +1,88 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
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'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
base {
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
String buildNumber = System.getenv("RUN_NUMBER")
|
||||||
|
version = "${mod_version}+${libs.versions.minecraft.get()}" + (buildNumber != null ? "-${buildNumber}" : "")
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
String buildNumber = System.getenv("GITEA_RUN_NUMBER")
|
|
||||||
version = "${mod_version}+${minecraft_version}" + (buildNumber != null ? "-${buildNumber}" : "")
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Add repositories to retrieve artifacts from in here.
|
// Add repositories to retrieve artifacts from in here.
|
||||||
// You should only use this when depending on other mods because
|
// You should only use this when depending on other mods because
|
||||||
// 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://dvs1.progwml6.com/files/maven/" } // JEI
|
|
||||||
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings
|
|
||||||
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://mvn.devos.one/snapshots/" } // Create, Porting Lib, Forge Tags, Milk Lib, Registrate
|
|
||||||
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
|
||||||
|
|
||||||
maven {
|
exclusiveContent {
|
||||||
url 'https://www.cursemaven.com'
|
forRepository {
|
||||||
content {
|
maven {
|
||||||
includeGroup "curse.maven"
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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("curse.maven:new-thin-air-878379:4611944")
|
modImplementation libs.thinair
|
||||||
|
|
||||||
|
// Ad Astra
|
||||||
|
modImplementation libs.adastra
|
||||||
|
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
|
||||||
|
|
||||||
// Recipe Viewers - Create Fabric supports JEI, REI, and EMI.
|
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")))
|
||||||
// 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:${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, 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": libs.versions.fabric.loader.get(),
|
||||||
properties.put("fabric_api_version", fabric_api_version)
|
"fabric_api_version": libs.versions.fabric.api.get(),
|
||||||
properties.put("create_version", create_version)
|
"create_version": libs.versions.create.get(),
|
||||||
properties.put("minecraft_version", minecraft_version)
|
"minecraft_version": libs.versions.minecraft.get()
|
||||||
|
]
|
||||||
|
|
||||||
properties.forEach((k, v) -> inputs.property(k, v))
|
inputs.properties(properties)
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
filesMatching("fabric.mod.json") {
|
||||||
expand properties
|
expand properties
|
||||||
@ -91,32 +91,18 @@ 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 {
|
||||||
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()}"}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +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.14.24
|
|
||||||
# check this on https://modmuss50.me/fabric.html
|
|
||||||
fabric_api_version=0.90.0+1.20.1
|
|
||||||
|
|
||||||
# Mappings
|
|
||||||
# https://lambdaurora.dev/tools/import_quilt.html
|
|
||||||
qm_version = 23
|
|
||||||
# https://parchmentmc.org/docs/getting-started
|
|
||||||
parchment_version = 2023.06.26
|
|
||||||
|
|
||||||
# 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-d-build.1161+mc1.20.1
|
|
||||||
# set to disabled to have none of them.
|
|
||||||
recipe_viewer = disabled
|
|
||||||
# Mod Menu - https://modrinth.com/mod/modmenu/versions
|
|
||||||
modmenu_version = 4.1.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" }
|
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.1.1-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
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package ru.bitheaven.createairfabric;
|
package ru.bitheaven.createairfabric;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import fuzs.thinair.helper.AirHelper;
|
import earth.terrarium.adastra.api.systems.OxygenApi;
|
||||||
import fuzs.thinair.helper.AirQualityLevel;
|
import fuzs.thinair.helper.AirQualityHelperImpl;
|
||||||
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.LivingEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -18,18 +17,17 @@ public class CreateAirFabric implements ModInitializer {
|
|||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
LOGGER.info("Create addon mod [{}] is loading alongside Create [{}]!", NAME, Create.VERSION);
|
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) {
|
public static boolean isOxygen(LivingEntity entity) {
|
||||||
final var air = AirHelper.getO2LevelFromLocation(entity.getEyePosition(), entity.level()).getFirst();
|
boolean oxygen = true;
|
||||||
return air == AirQualityLevel.RED || air == AirQualityLevel.YELLOW;
|
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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,25 @@
|
|||||||
package ru.bitheaven.createairfabric.mixin;
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
import fuzs.thinair.helper.AirHelper;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import fuzs.thinair.helper.AirQualityLevel;
|
|
||||||
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 com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
|
||||||
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;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
|
|
||||||
@Mixin(DivingHelmetItem.class)
|
@Mixin(DivingHelmetItem.class)
|
||||||
public abstract class DivingHelmetItemMixin {
|
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) {
|
||||||
return entity.isEyeInFluid(fluidTagKey) || CreateAirFabric.airQualityActivatesHelmet(entity);
|
boolean oxygen = true;
|
||||||
|
oxygen &= !original;
|
||||||
|
oxygen &= !entity.isUnderWater();
|
||||||
|
oxygen &= CreateAirFabric.isOxygen(entity);
|
||||||
|
|
||||||
|
return !oxygen;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
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.BacktankUtil;
|
||||||
|
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||||
|
import earth.terrarium.adastra.common.systems.OxygenApiImpl;
|
||||||
|
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Mixin(OxygenApiImpl.class)
|
||||||
|
public abstract class EntityOxygenSystemMixin {
|
||||||
|
/**
|
||||||
|
* Make air exists if Create Air
|
||||||
|
*/
|
||||||
|
@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")
|
||||||
|
private boolean redirectHasOxygen(boolean original, ServerLevel level, LivingEntity entity) {
|
||||||
|
boolean createOxygen = true;
|
||||||
|
createOxygen &= !DivingHelmetItem.getWornItem(entity).isEmpty();
|
||||||
|
createOxygen &= !BacktankUtil.getAllWithAir(entity).isEmpty();
|
||||||
|
return original || createOxygen;
|
||||||
|
}
|
||||||
|
@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")
|
||||||
|
private boolean redirectHasFullSet(boolean original, ServerLevel level, 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 original || createArmor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
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.server.level.ServerLevel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Mixin(TemperatureApiImpl.class)
|
||||||
|
public abstract class EntityTemperatureSystemMixin {
|
||||||
|
@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")
|
||||||
|
private boolean redirectTemperatureTick(boolean original, ServerLevel level, 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();
|
||||||
|
|
||||||
|
return original && !createNetherite;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package ru.bitheaven.createairfabric.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import ru.bitheaven.createairfabric.CreateAirFabric;
|
||||||
|
|
||||||
|
@Mixin(RemainingAirOverlay.class)
|
||||||
|
public class RemainingAirOverlayMixin {
|
||||||
|
/**
|
||||||
|
* Activate UI "if in water or lava" -> "if in water or bad air or lava"
|
||||||
|
*/
|
||||||
|
@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")
|
||||||
|
private static boolean redirectRender(boolean original) {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
LocalPlayer player = mc.player;
|
||||||
|
return original || !CreateAirFabric.isOxygen(player);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 60 KiB |
@ -3,11 +3,15 @@
|
|||||||
"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",
|
||||||
|
"RemainingAirOverlayMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
@ -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"
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user