✨ feature(jade): add initial work on jade plugin :3
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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" }
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ pluginManagement {
|
||||
|
||||
rootProject.name = "Firmament"
|
||||
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
include("symbols")
|
||||
include("javaplugin")
|
||||
include("testagent")
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
16
src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt
Normal file
16
src/compat/jade/java/moe/nea/firmament/compat/jade/utils.kt
Normal file
@@ -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)
|
||||
@@ -40,6 +40,9 @@
|
||||
"modmenu": [
|
||||
"moe.nea.firmament.compat.modmenu.FirmamentModMenuPlugin"
|
||||
],
|
||||
"jade": [
|
||||
"moe.nea.firmament.compat.jade.FirmamentJadePlugin"
|
||||
],
|
||||
"jarvis": [
|
||||
"moe.nea.firmament.jarvis.JarvisIntegration"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user