1.19 and no more forge

This commit is contained in:
nea
2022-07-26 23:12:13 +02:00
parent cc9c23914b
commit 386ee78026
18 changed files with 15 additions and 403 deletions

View File

@@ -3,11 +3,11 @@ package moe.nea.notenoughupdates
import dev.architectury.registry.registries.Registries
import io.github.moulberry.repo.NEURepository
import java.nio.file.Path
import java.util.logging.Logger
object NotEnoughUpdates {
val REGISTRIES by lazy { Registries.get(MOD_ID) }
const val MOD_ID = "notenoughupdates"
val neuRepo = NEURepository.of(Path.of("NotEnoughUpdates-REPO")).also {

View File

@@ -28,6 +28,7 @@ class NEUReiPlugin : REIClientPlugin {
registry.register(SKYBLOCK_ITEM_TYPE_ID, SBItemEntryDefinition)
}
override fun registerEntries(registry: EntryRegistry) {
neuRepo.items.items.values.forEach {
if (!it.isVanilla)

View File

@@ -6,6 +6,7 @@ import me.shedaniel.math.Point
import me.shedaniel.math.Rectangle
import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer
import me.shedaniel.rei.api.client.gui.widgets.Tooltip
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
import me.shedaniel.rei.api.common.entry.EntrySerializer
import me.shedaniel.rei.api.common.entry.EntryStack
import me.shedaniel.rei.api.common.entry.comparison.ComparisonContext
@@ -50,9 +51,9 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
)
}
override fun getTooltip(entry: EntryStack<NEUItem>, mouse: Point): Tooltip? {
override fun getTooltip(entry: EntryStack<NEUItem>, tooltipContext: TooltipContext): Tooltip? {
return VanillaEntryTypes.ITEM.definition.renderer
.getTooltip(entry.asItemEntry(), mouse)
.getTooltip(entry.asItemEntry(), tooltipContext)
}
}

View File

@@ -8,7 +8,7 @@ import moe.nea.notenoughupdates.util.LegacyTagParser
import moe.nea.notenoughupdates.util.appendLore
import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.NbtOps
import net.minecraft.network.chat.TextComponent
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.datafix.DataFixers
import net.minecraft.util.datafix.fixes.References
@@ -46,8 +46,8 @@ object ItemCache : IReloadable {
val oldItemTag = get10809CompoundTag()
val modernItemTag = oldItemTag.transformFrom10809ToModern()
?: return ItemStack(Items.PAINTING).apply {
setHoverName(TextComponent(this@asItemStackNow.displayName))
appendLore(listOf(TextComponent("Exception rendering item: $skyblockItemId")))
setHoverName(Component.literal(this@asItemStackNow.displayName))
appendLore(listOf(Component.literal("Exception rendering item: $skyblockItemId")))
}
val itemInstance = ItemStack.of(modernItemTag)
if (itemInstance.tag?.contains("Enchantments") == true) {
@@ -69,7 +69,6 @@ object ItemCache : IReloadable {
ResourceLocation("skyblockitem", skyblockItemId.lowercase().replace(";", "__"))
override fun reload(repository: NEURepository) {
cache.clear()
}

View File

@@ -1,108 +0,0 @@
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}
architectury {
platformSetupLoomIde()
forge()
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
forge {
convertAccessWideners.set(true)
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
}
}
/**
* @see: https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html
* */
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
val developmentForge: Configuration = configurations.getByName("developmentForge")
configurations {
compileClasspath.get().extendsFrom(configurations["common"])
runtimeClasspath.get().extendsFrom(configurations["common"])
developmentForge.extendsFrom(configurations["common"])
}
dependencies {
forge("net.minecraftforge:forge:${rootProject.property("forge_version")}")
// Remove the next line if you don't want to depend on the API
modApi("dev.architectury:architectury-forge:${rootProject.property("architectury_version")}")
common(project(":common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(":common", configuration = "transformProductionForge")) { isTransitive = false }
common(kotlin("stdlib-jdk8"))
modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.property("rei_version")}")
}
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["sourcesElements"]) {
skip()
}
tasks {
processResources {
inputs.property("version", project.version)
filesMatching("META-INF/mods.toml") {
expand("version" to project.version)
}
}
shadowJar {
exclude("fabric.mod.json")
exclude("architectury.common.json")
/**
* magic!
* groovy -> kotlin dsl
* [project.configurations.shadowCommon] -> listOf(project.configurations["shadowCommon"])
* */
configurations = listOf(project.configurations["shadowCommon"])
archiveClassifier.set("dev-shadow")
}
remapJar {
/**
* magic!
* groovy -> kotlin dsl
* shadowJar.archiveFile -> shadowJar.flatMap { it.archiveFile }
* */
inputFile.set(shadowJar.flatMap { it.archiveFile })
dependsOn(shadowJar)
/**
* affect suffix of build jar name
* if { archiveClassifier.set("forge") }
* name will be examplemod-1.0.0-forge.jar
*/
archiveClassifier.set("forge")
}
jar {
archiveClassifier.set("dev")
}
sourcesJar {
val commonSources = project(":common").tasks.getByName("sourcesJar", Jar::class)
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}
publishing {
publications {
create<MavenPublication>("mavenForge") {
artifactId = "${rootProject.property("archives_base_name")}-${project.name}"
from(javaComponent)
}
}
// 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.
}
}
}

View File

@@ -1 +0,0 @@
loom.platform=forge

View File

@@ -1,14 +0,0 @@
package net.examplemod.forge
import net.minecraftforge.fml.loading.FMLPaths
import java.nio.file.Path
import net.examplemod.ExampleExpectPlatform
@Suppress("unused")
object ExampleExpectPlatformImpl {
/**
* This is our actual method to [ExampleExpectPlatform.getConfigDirectory].
*/
@JvmStatic
fun getConfigDirectory(): Path = FMLPaths.CONFIGDIR.get()
}

View File

@@ -1,16 +0,0 @@
package net.examplemod.forge
import dev.architectury.platform.forge.EventBuses
import moe.nea.notenoughupdates.NotEnoughUpdates
import moe.nea.notenoughupdates.NotEnoughUpdates.init
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
@Mod(NotEnoughUpdates.MOD_ID)
class ExampleModForge {
init {
// Submit our event bus to let architectury register our content on the right time
EventBuses.registerModEventBus(NotEnoughUpdates.MOD_ID, FMLJavaModLoadingContext.get().modEventBus)
init()
}
}

View File

@@ -1,35 +0,0 @@
modLoader = "javafml"
loaderVersion = "[40,)"
#issueTrackerURL = "TODO"
license = "LGPL-3.0"
[[mods]]
modId = "notenoughupdates"
version = "${version}"
displayName = "Not Enough Updates"
authors = "nea89"
description = '''
Not Enough Updates - A mod for Hypixel Skyblock
'''
#logoFile = ""
[[dependencies.notenoughupdates]]
modId = "forge"
mandatory = true
versionRange = "[40,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.notenoughupdates]]
modId = "minecraft"
mandatory = true
versionRange = "[1.18.2,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.notenoughupdates]]
modId = "architectury"
mandatory = true
versionRange = "[4.2.50,)"
ordering = "AFTER"
side = "BOTH"

View File

@@ -1,12 +0,0 @@
{
"required": true,
"package": "net.examplemod.mixin.forge",
"compatibilityLevel": "JAVA_16",
"client": [
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}

View File

@@ -1,6 +0,0 @@
{
"pack": {
"description": "Example Mod",
"pack_format": 8
}
}

View File

@@ -1,25 +1,19 @@
org.gradle.jvmargs=-Xmx4096M
minecraft_version=1.18.2
enabled_platforms=quilt,fabric,forge
minecraft_version=1.19
enabled_platforms=fabric
archives_base_name=notenoughupdates
mod_version=1.0.0
maven_group=moe.nea.notenoughupdates
architectury_version=4.2.50
architectury_version=5.10.33
fabric_loader_version=0.14.0
fabric_api_version=0.51.1+1.18.2
forge_version=1.18.2-40.1.0
quilt_loader_version=0.16.0-beta.7
quilt_fabric_api_version=1.0.0-beta.7+0.51.1-1.18.2
fabric_loader_version=0.14.8
fabric_api_version=0.58.0+1.19
kotlin_version=1.7.0-RC
rei_version=8.0.+
rei_version=9.1.518
devauth_version=1.0.0
modmenu_version=3.2.3
modmenu_version=4.0.4

View File

@@ -1,118 +0,0 @@
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}
repositories {
maven { url = uri("https://maven.quiltmc.org/repository/release/") }
mavenCentral()
}
architectury {
platformSetupLoomIde()
loader("quilt")
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}
/**
* @see: https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html
* */
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
val developmentQuilt: Configuration = configurations.getByName("developmentQuilt")
configurations {
compileClasspath.get().extendsFrom(configurations["common"])
runtimeClasspath.get().extendsFrom(configurations["common"])
developmentQuilt.extendsFrom(configurations["common"])
}
dependencies {
modImplementation("org.quiltmc:quilt-loader:${rootProject.property("quilt_loader_version")}")
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.property("quilt_fabric_api_version")}")
// Remove the next few lines if you don't want to depend on the API
modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}") {
// We must not pull Fabric Loader from Architectury Fabric
exclude(group = "net.fabricmc")
exclude(group = "net.fabricmc.fabric-api")
}
common(project(":common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(":common", configuration = "transformProductionQuilt")) { isTransitive = false }
common(kotlin("stdlib-jdk8"))
}
val javaComponent = components.getByName("java", AdhocComponentWithVariants::class)
javaComponent.withVariantsFromConfiguration(configurations["sourcesElements"]) {
skip()
}
tasks {
processResources {
inputs.property("group", rootProject.property("maven_group"))
inputs.property("version", project.version)
filesMatching("quilt.mod.json") {
expand(
"group" to rootProject.property("maven_group"),
"version" to project.version
)
}
}
shadowJar {
exclude("architectury.common.json")
/**
* magic!
* groovy -> kotlin dsl
* [project.configurations.shadowCommon] -> listOf(project.configurations["shadowCommon"])
* */
configurations = listOf(project.configurations["shadowCommon"])
archiveClassifier.set("dev-shadow")
}
remapJar {
injectAccessWidener.set(true)
/**
* magic!
* groovy -> kotlin dsl
* shadowJar.archiveFile -> shadowJar.flatMap { it.archiveFile }
* */
inputFile.set(shadowJar.flatMap { it.archiveFile })
dependsOn(shadowJar)
/**
* affect suffix of build jar name
* if { archiveClassifier.set("quilt") }
* name will be examplemod-1.0.0-quilt.jar
*/
archiveClassifier.set("quilt")
}
jar {
archiveClassifier.set("dev")
}
sourcesJar {
val commonSources = project(":common").tasks.getByName("sourcesJar", Jar::class)
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}
publishing {
publications {
create<MavenPublication>("mavenQuilt") {
artifactId = "${rootProject.property("archives_base_name")}-${project.name}"
from(javaComponent)
}
}
// 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.
}
}
}

View File

@@ -1 +0,0 @@
loom.platform=quilt

View File

@@ -1,13 +0,0 @@
package net.examplemod.fabric
import org.quiltmc.loader.api.QuiltLoader
import java.nio.file.Path
import net.examplemod.ExampleExpectPlatform
object ExampleExpectPlatformImpl {
/**
* This is our actual method to [ExampleExpectPlatform.getConfigDirectory].
*/
@JvmStatic
fun getConfigDirectory(): Path = QuiltLoader.getConfigDir()
}

View File

@@ -1,12 +0,0 @@
package net.examplemod.quilt
import moe.nea.notenoughupdates.NotEnoughUpdates.init
import org.quiltmc.loader.api.ModContainer
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer
@Suppress("unused")
class ExampleModQuilt : ModInitializer {
override fun onInitialize(mod: ModContainer) {
init()
}
}

View File

@@ -1,45 +0,0 @@
{
"schema_version": 1,
"mixins": [
"notenoughupdates.mixins.json",
"notenoughupdates-common.mixins.json"
],
"quilt_loader": {
"group": "${group}",
"id": "notenoughupdates",
"version": "${version}",
"name": "Not Enough Updates",
"description": "Not Enough Updates - A mod for Hypixel Skyblock",
"authors": ["nea89"],
"contact": {
"sources": "https://github.com/romangraef/TODO"
},
"license": "LGPL-3.0",
"icon": "assets/notenoughupdates/icon.png",
"intermediate_mappings": "net.fabricmc:intermediary",
"environment": "*",
"entrypoints": {
"init": [
"net.examplemod.quilt.ExampleModQuilt"
]
},
"depends": [
{
"id": "quilt_loader",
"version": "*"
},
{
"id": "quilt_base",
"version": "*"
},
{
"id": "minecraft",
"version": ">=1.18.2"
},
{
"id": "architectury",
"version": ">=4.2.50"
}
]
}
}

View File

@@ -18,8 +18,6 @@ pluginManagement {
include("common")
include("fabric")
include("quilt")
include("forge")
rootProject.name = "NotEnoughApdates"