Skip to content

Commit

Permalink
add trinkets as air source (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle authored Aug 30, 2023
1 parent a2fbc68 commit c0cb3b9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
16 changes: 15 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ val caelus_version: String by extra
val jei_version: String by extra
val emi_version: String by extra
val night_config_version: String by extra
val trinkets_version: String by extra
val cca_version: String by extra

plugins {
id("com.possible-triangle.gradle") version("0.1.0")
id("com.possible-triangle.gradle") version ("0.1.0")
}

withKotlin()
Expand Down Expand Up @@ -49,10 +51,22 @@ repositories {
includeGroup("com.possible_triangle")
}
}

maven {
url = uri("https://maven.ladysnake.org/releases")
content {
includeGroup("dev.onyxstudios.cardinal-components-api")
}
}
}

dependencies {
modApi("com.simibubi.create:create-fabric-${mc_version}:${create_version}")
modApi("dev.emi:trinkets:${trinkets_version}")

// Should be included with trinkets but is not available at runtime somehow
modCompileOnly("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${cca_version}")
modCompileOnly("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cca_version}")

if (!env.isCI) {
modRuntimeOnly("mezz.jei:jei-${mc_version}-fabric:${jei_version}")
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ create_version=0.5.1-d-build.1161+mc1.20.1
night_config_version=3.6.7
flightlib_version=2.0.0
kotlin_fabric_version=1.9.6+kotlin.1.8.22
trinkets_version=3.7.1
cca_version=5.2.0

repository=pssbletrngle/createjetpack-fabric
modrinth_project_id=UbFnAd4l
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.possible_triangle.create_jetpack;

import com.possible_triangle.create_jetpack.compat.TrinketsCompat;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.loader.api.FabricLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -15,6 +17,10 @@ public class CreateJetpackMod implements ModInitializer, ClientModInitializer, D
@Override
public void onInitialize() {
Content.INSTANCE.register();

if(FabricLoader.getInstance().isModLoaded("trinkets")) {
TrinketsCompat.INSTANCE.register();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.possible_triangle.create_jetpack.compat

import com.simibubi.create.AllTags.AllItemTags.PRESSURIZED_AIR_SOURCES
import com.simibubi.create.content.equipment.armor.BacktankUtil
import dev.emi.trinkets.api.TrinketsApi
import kotlin.jvm.optionals.getOrNull

object TrinketsCompat {

fun register() {
BacktankUtil.addBacktankSupplier { entity ->
val trinkets = TrinketsApi.getTrinketComponent(entity).getOrNull()

trinkets?.allEquipped
?.map { tuple -> tuple.b }
?.filter { PRESSURIZED_AIR_SOURCES.matches(it) }
?: emptyList()
}
}

}

0 comments on commit c0cb3b9

Please sign in to comment.