aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauline <git@ethanlibs.co>2025-02-26 16:29:35 +0100
committerLinnea Gräf <nea@nea.moe>2025-03-08 16:01:00 +0100
commitd176e0a52e68ee7ee7a4b66feef9874fb954243b (patch)
treea411c5b5719893a456d34339cb6cea29a7d0ff93
parent145fff6a59f0f58305d6c057e97f2a1d6c958744 (diff)
downloadFirmament-d176e0a52e68ee7ee7a4b66feef9874fb954243b.tar.gz
Firmament-d176e0a52e68ee7ee7a4b66feef9874fb954243b.tar.bz2
Firmament-d176e0a52e68ee7ee7a4b66feef9874fb954243b.zip
✨ feature(jade): add initial work on jade plugin :3
Signed-off-by: Pauline <git@ethanlibs.co>
-rw-r--r--build.gradle.kts10
-rw-r--r--gradle/libs.versions.toml4
-rw-r--r--settings.gradle.kts1
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolHandler.kt22
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt17
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/FirmamentJadePlugin.kt48
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/GemstoneProvider.kt24
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/HardstoneProvider.kt24
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/MithrilProvider.kt24
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/SkyblockProgressProvider.kt31
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt16
-rw-r--r--src/main/resources/fabric.mod.json3
12 files changed, 220 insertions, 4 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 6c17883..ef24d5e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -229,6 +229,7 @@ val yaclSourceSet = createIsolatedSourceSet("yacl")
val explosiveEnhancementSourceSet =
createIsolatedSourceSet("explosiveEnhancement", isEnabled = false) // TODO: wait for their port
val wildfireGenderSourceSet = createIsolatedSourceSet("wildfireGender")
+val jadeSourceSet = createIsolatedSourceSet("jade")
val modmenuSourceSet = createIsolatedSourceSet("modmenu")
val reiSourceSet = createIsolatedSourceSet("rei")
val moulconfigSourceSet = createIsolatedSourceSet("moulconfig")
@@ -253,8 +254,8 @@ dependencies {
(explosiveEnhancementSourceSet.modImplementationConfigurationName)(libs.explosiveenhancement)
modImplementation(libs.hypixelmodapi)
include(libs.hypixelmodapi.fabric)
- compileOnly(project(":javaplugin"))
- annotationProcessor(project(":javaplugin"))
+ compileOnly(projects.javaplugin)
+ annotationProcessor(projects.javaplugin)
implementation("com.google.auto.service:auto-service-annotations:1.1.1")
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.2.0")
include(libs.manninghamMills)
@@ -278,6 +279,7 @@ dependencies {
(wildfireGenderSourceSet.implementationConfigurationName)(customTexturesSourceSet.output)
(configuredSourceSet.modImplementationConfigurationName)(libs.configured)
(sodiumSourceSet.modImplementationConfigurationName)(libs.sodium)
+ (jadeSourceSet.modImplementationConfigurationName)(libs.jade)
(citResewnSourceSet.modImplementationConfigurationName)(
innerJarsOf("citresewn", dependencies.create(libs.citresewn.get()))
@@ -315,8 +317,8 @@ dependencies {
testImplementation("io.kotest:kotest-runner-junit5:6.0.0.M1")
testAgent(project(":testagent", configuration = "shadow"))
- implementation(project(":symbols"))
- ksp(project(":symbols"))
+ implementation(projects.symbols)
+ ksp(projects.symbols)
}
loom {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index bab7459..7b16a7b 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -48,6 +48,9 @@ notenoughanimations = "eZykTicT"
# Update from https://modrinth.com/mod/cit-resewn/versions?l=fabric
citresewn = "1.2.0+1.21"
+# Update from https://modrinth.com/mod/jade/versions?l=fabric
+jade = "17.2.2+fabric"
+
devauth = "1.2.1"
# Update from https://ktor.io/
@@ -125,6 +128,7 @@ sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" }
freecammod = { module = "maven.modrinth:freecam", version.ref = "freecammod" }
citresewn = { module = "maven.modrinth:cit-resewn", version.ref = "citresewn" }
femalegender = { module = "maven.modrinth:female-gender", version.ref = "femalegender" }
+jade = { module = "maven.modrinth:jade", version.ref = "jade" }
yacl = { module = "dev.isxander:yet-another-config-lib", version.ref = "yacl" }
basicMath = { module = "me.shedaniel.cloth:basic-math", version.ref = "basicMath" }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index aef468a..8a5dc47 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -35,6 +35,7 @@ pluginManagement {
rootProject.name = "Firmament"
+enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include("symbols")
include("javaplugin")
include("testagent")
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolHandler.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolHandler.kt
new file mode 100644
index 0000000..d31532a
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolHandler.kt
@@ -0,0 +1,22 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.addon.harvest.ToolHandler
+import net.minecraft.block.BlockState
+import net.minecraft.item.ItemStack
+import net.minecraft.util.Identifier
+import net.minecraft.util.math.BlockPos
+import net.minecraft.world.World
+
+class DrillToolHandler : ToolHandler {
+ override fun test(state: BlockState, world: World, pos: BlockPos): ItemStack {
+ TODO("We need to override the existing tool handler tests because they use state.getHardness(world, pos), which doesn't work with Skyblocks NMS fuckery")
+ }
+
+ override fun getTools(): List<ItemStack> {
+ TODO("Not yet implemented")
+ }
+
+ override fun getUid(): Identifier {
+ TODO("Not yet implemented")
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt
new file mode 100644
index 0000000..2517725
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt
@@ -0,0 +1,17 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.BlockAccessor
+import snownee.jade.api.IBlockComponentProvider
+import snownee.jade.api.ITooltip
+import snownee.jade.api.config.IPluginConfig
+import net.minecraft.util.Identifier
+
+class DrillToolProvider : IBlockComponentProvider {
+ override fun appendTooltip(tooltip: ITooltip, accessor: BlockAccessor, config: IPluginConfig) {
+ TODO("Not yet implemented")
+ }
+
+ override fun getUid(): Identifier {
+ TODO("Not yet implemented")
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/FirmamentJadePlugin.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/FirmamentJadePlugin.kt
new file mode 100644
index 0000000..8990646
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/FirmamentJadePlugin.kt
@@ -0,0 +1,48 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.IWailaClientRegistration
+import snownee.jade.api.IWailaCommonRegistration
+import snownee.jade.api.IWailaPlugin
+import snownee.jade.api.WailaPlugin
+import net.minecraft.block.Blocks
+import moe.nea.firmament.Firmament
+
+// TODO: make this display breaking power, override names of mineable blocks, and override breaking indicator to use mining fatigue system
+@WailaPlugin
+class FirmamentJadePlugin : IWailaPlugin {
+ override fun register(registration: IWailaCommonRegistration) {
+ Firmament.logger.debug("Registering Jade integration...")
+ }
+
+ override fun registerClient(registration: IWailaClientRegistration) {
+ registration.registerBlockComponent(MithrilProvider("prismarine"), Blocks.PRISMARINE::class.java)
+ registration.registerBlockComponent(MithrilProvider("gray_wool"), Blocks.GRAY_WOOL::class.java)
+ registration.registerBlockComponent(MithrilProvider("gray_concrete"), Blocks.GRAY_CONCRETE::class.java)
+ // and together, we are the crystal gems of celeste minecraft (surely there's a better way to do this :sob:)
+ registration.registerBlockComponent(GemstoneProvider("red_stained_glass", "ruby"), Blocks.RED_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("red_stained_glass_pane", "ruby"), Blocks.RED_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("purple_stained_glass", "amethyst"), Blocks.PURPLE_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("purple_stained_glass_pane", "amethyst"), Blocks.PURPLE_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("lime_stained_glass", "jade"), Blocks.LIME_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("lime_stained_glass_pane", "jade"), Blocks.LIME_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("blue_stained_glass", "sapphire"), Blocks.BLUE_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("blue_stained_glass_pane", "sapphire"), Blocks.BLUE_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("orange_stained_glass", "amber"), Blocks.ORANGE_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("orange_stained_glass_pane", "amber"), Blocks.ORANGE_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("yellow_stained_glass", "topaz"), Blocks.YELLOW_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("yellow_stained_glass_pane", "topaz"), Blocks.YELLOW_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("magenta_stained_glass", "jasper"), Blocks.MAGENTA_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("magenta_stained_glass_pane", "jasper"), Blocks.MAGENTA_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("white_stained_glass", "opal"), Blocks.WHITE_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("white_stained_glass_pane", "opal"), Blocks.WHITE_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("blue_stained_glass", "aquamarine"), Blocks.BLUE_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("blue_stained_glass_pane", "aquamarine"), Blocks.BLUE_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("black_stained_glass", "onyx"), Blocks.BLACK_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("black_stained_glass_pane", "onyx"), Blocks.BLACK_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("brown_stained_glass", "citrine"), Blocks.BROWN_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("brown_stained_glass_pane", "citrine"), Blocks.BROWN_STAINED_GLASS_PANE::class.java)
+ registration.registerBlockComponent(GemstoneProvider("green_stained_glass", "peridot"), Blocks.GREEN_STAINED_GLASS::class.java)
+ registration.registerBlockComponent(GemstoneProvider("green_stained_glass_pane", "peridot"), Blocks.GREEN_STAINED_GLASS_PANE::class.java)
+ registration.registerProgressClient(SkyblockProgressProvider())
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/GemstoneProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/GemstoneProvider.kt
new file mode 100644
index 0000000..883da12
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/GemstoneProvider.kt
@@ -0,0 +1,24 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.BlockAccessor
+import snownee.jade.api.IBlockComponentProvider
+import snownee.jade.api.ITooltip
+import snownee.jade.api.config.IPluginConfig
+import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+import moe.nea.firmament.util.SBData
+
+class GemstoneProvider(val type: String, val replacement: String) : IBlockComponentProvider {
+ override fun appendTooltip(tooltip: ITooltip, accessor: BlockAccessor, config: IPluginConfig) {
+ if (SBData.isOnSkyblock) {
+ tooltip.add(drillIcon)
+ // TODO: override jade breakability test to include breaking power of drills on mining islands
+ tooltip.append(Text.of("Breaking Power 6/7/8/9/10")) // TODO: Use NEU API/add new data for breaking power
+ tooltip.replace(Identifier.of("minecraft", type), Text.literal("Gemstone $type of $replacement y")) // this doesnt work
+ }
+ }
+
+ override fun getUid(): Identifier {
+ return "gemstone_${type}_${replacement}".jadeId()
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/HardstoneProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/HardstoneProvider.kt
new file mode 100644
index 0000000..7e12d7f
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/HardstoneProvider.kt
@@ -0,0 +1,24 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.BlockAccessor
+import snownee.jade.api.IBlockComponentProvider
+import snownee.jade.api.ITooltip
+import snownee.jade.api.config.IPluginConfig
+import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+import moe.nea.firmament.util.SBData
+
+class HardstoneProvider : IBlockComponentProvider {
+ override fun appendTooltip(tooltip: ITooltip, accessor: BlockAccessor, config: IPluginConfig) {
+ if (SBData.isOnSkyblock) {
+ tooltip.add(drillIcon)
+ // TODO: override jade breakability test to include breaking power of drills on mining islands
+ tooltip.append(Text.of("Breaking Power 5"))
+ tooltip.replace(Identifier.of("minecraft", "stone"), Text.literal("Hard Stone")) // this doesnt work
+ }
+ }
+
+ override fun getUid(): Identifier {
+ return "hardstone".jadeId()
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/MithrilProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/MithrilProvider.kt
new file mode 100644
index 0000000..e5746fa
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/MithrilProvider.kt
@@ -0,0 +1,24 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.BlockAccessor
+import snownee.jade.api.IBlockComponentProvider
+import snownee.jade.api.ITooltip
+import snownee.jade.api.config.IPluginConfig
+import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+import moe.nea.firmament.util.SBData
+
+class MithrilProvider(val type: String) : IBlockComponentProvider {
+ override fun appendTooltip(tooltip: ITooltip, accessor: BlockAccessor, config: IPluginConfig) {
+ if (SBData.isOnSkyblock) { // why is there no utility to check if we are on an island with mithril am i dumb
+ tooltip.add(drillIcon)
+ tooltip.append(Text.of("Breaking Power 5"))
+ tooltip.replace(Identifier.of("minecraft", type), Text.literal("Mithril $type")) // this doesnt work
+ }
+ }
+
+ override fun getUid(): Identifier {
+ return "mithril_$type".jadeId()
+ }
+}
+
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/SkyblockProgressProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/SkyblockProgressProvider.kt
new file mode 100644
index 0000000..cdb849f
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/SkyblockProgressProvider.kt
@@ -0,0 +1,31 @@
+package moe.nea.firmament.compat.jade
+
+import java.util.function.BiConsumer
+import snownee.jade.api.Accessor
+import snownee.jade.api.view.ClientViewGroup
+import snownee.jade.api.view.IClientExtensionProvider
+import snownee.jade.api.view.ProgressView
+import snownee.jade.api.view.ViewGroup
+import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+
+class SkyblockProgressProvider : IClientExtensionProvider<ProgressView.Data, ProgressView> {
+ // wtf does this do i think its for the little progress bar which breaks in mining fatigue mining system
+ // but like this is just copied from the example plugin soo
+ // TODO :3
+ override fun getClientGroups(accessor: Accessor<*>, groups: List<ViewGroup<ProgressView.Data>>): List<ClientViewGroup<ProgressView>> {
+ return ClientViewGroup.map(groups, ProgressView::read,
+ BiConsumer { group: ViewGroup<ProgressView.Data>, clientGroup: ClientViewGroup<ProgressView> ->
+ var view = clientGroup.views.first()
+ view.style.color(-0x340000)
+ view.text = Text.literal("e")
+ view = clientGroup.views[1]
+ view.style.color(-0xff3400)
+ view.text = Text.literal("!!")
+ })
+ }
+
+ override fun getUid(): Identifier? {
+ return "progress".jadeId()
+ }
+}
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt
new file mode 100644
index 0000000..3a0a18c
--- /dev/null
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt
@@ -0,0 +1,16 @@
+package moe.nea.firmament.compat.jade
+
+import snownee.jade.api.ui.IElement
+import snownee.jade.api.ui.IElementHelper
+import net.minecraft.item.ItemStack
+import net.minecraft.item.Items
+import net.minecraft.util.Identifier
+import moe.nea.firmament.util.SkyblockId
+import moe.nea.firmament.util.setSkyBlockId
+
+
+fun String.jadeId(): Identifier = Identifier.of("firmament", this)
+
+// This drill icon should work for CIT resource packs
+val drillItem: ItemStack = Items.PRISMARINE_SHARD.defaultStack.setSkyBlockId(SkyblockId("TITANIUM_DRILL_1"))
+val drillIcon: IElement = IElementHelper.get().item(drillItem, 0.5f).message(null)
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index cf7130b..02c11ee 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -40,6 +40,9 @@
"modmenu": [
"moe.nea.firmament.compat.modmenu.FirmamentModMenuPlugin"
],
+ "jade": [
+ "moe.nea.firmament.compat.jade.FirmamentJadePlugin"
+ ],
"jarvis": [
"moe.nea.firmament.jarvis.JarvisIntegration"
]