repo reloading
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
|||||||
`maven-publish`
|
`maven-publish`
|
||||||
kotlin("jvm") version "1.7.10"
|
kotlin("jvm") version "1.7.10"
|
||||||
id("dev.architectury.loom") version "0.12.0.+"
|
id("dev.architectury.loom") version "0.12.0.+"
|
||||||
id("com.github.johnrengelman.plugin-shadow") version "2.0.3"
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@@ -13,6 +13,7 @@ loom {
|
|||||||
launches {
|
launches {
|
||||||
removeIf { it.name != "client" }
|
removeIf { it.name != "client" }
|
||||||
named("client") {
|
named("client") {
|
||||||
|
property("devauth.enabled", "true")
|
||||||
property("fabric.log.level", "info")
|
property("fabric.log.level", "info")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,7 @@ dependencies {
|
|||||||
// Fabric dependencies
|
// Fabric dependencies
|
||||||
modImplementation("net.fabricmc:fabric-loader:${project.property("fabric_loader_version")}")
|
modImplementation("net.fabricmc:fabric-loader:${project.property("fabric_loader_version")}")
|
||||||
modApi("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_api_version")}")
|
modApi("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_api_version")}")
|
||||||
modImplementation("net.fabricmc:fabric-language-kotlin:1.8.2+kotlin.1.7.10")
|
modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("fabric_kotlin_version")}")
|
||||||
|
|
||||||
// Actual dependencies
|
// Actual dependencies
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.property("rei_version")}")
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.property("rei_version")}")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ architectury_version=5.10.33
|
|||||||
|
|
||||||
fabric_loader_version=0.14.8
|
fabric_loader_version=0.14.8
|
||||||
fabric_api_version=0.58.0+1.19
|
fabric_api_version=0.58.0+1.19
|
||||||
|
fabric_kotlin_version=1.8.2+kotlin.1.7.10
|
||||||
|
|
||||||
rei_version=9.1.518
|
rei_version=9.1.518
|
||||||
devauth_version=1.0.0
|
devauth_version=1.0.0
|
||||||
|
|||||||
@@ -1,18 +1,47 @@
|
|||||||
package moe.nea.notenoughupdates
|
package moe.nea.notenoughupdates
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher
|
||||||
import io.github.moulberry.repo.NEURepository
|
import io.github.moulberry.repo.NEURepository
|
||||||
|
import moe.nea.notenoughupdates.repo.ItemCache
|
||||||
|
import net.fabricmc.api.ClientModInitializer
|
||||||
import net.fabricmc.api.ModInitializer
|
import net.fabricmc.api.ModInitializer
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
|
||||||
|
import net.minecraft.client.Minecraft
|
||||||
|
import net.minecraft.commands.CommandBuildContext
|
||||||
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
object NotEnoughUpdates : ModInitializer {
|
object NotEnoughUpdates : ModInitializer, ClientModInitializer {
|
||||||
val DATA_DIR = Path.of(".notenoughupdates")
|
val DATA_DIR = Path.of(".notenoughupdates")
|
||||||
|
|
||||||
const val MOD_ID = "notenoughupdates"
|
const val MOD_ID = "notenoughupdates"
|
||||||
|
|
||||||
val neuRepo = NEURepository.of(Path.of("NotEnoughUpdates-REPO")).also {
|
val neuRepo: NEURepository = NEURepository.of(Path.of("NotEnoughUpdates-REPO")).apply {
|
||||||
it.reload()
|
registerReloadListener(ItemCache)
|
||||||
|
reload()
|
||||||
|
registerReloadListener {
|
||||||
|
Minecraft.getInstance().connection?.handleUpdateRecipes(ClientboundUpdateRecipesPacket(mutableListOf()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerCommands(
|
||||||
|
dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandBuildContext
|
||||||
|
) {
|
||||||
|
dispatcher.register(ClientCommandManager.literal("neureload").executes {
|
||||||
|
it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit."))
|
||||||
|
neuRepo.reload()
|
||||||
|
0
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInitialize() {
|
override fun onInitialize() {
|
||||||
|
ClientCommandRegistrationCallback.EVENT.register(this::registerCommands)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitializeClient() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ class NEUReiPlugin : REIClientPlugin {
|
|||||||
return EntryStack.of(VanillaEntryTypes.ITEM, value.asItemStack())
|
return EntryStack.of(VanillaEntryTypes.ITEM, value.asItemStack())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val SKYBLOCK_ITEM_TYPE_ID = ResourceLocation("notenoughupdates", "skyblockitems")
|
val SKYBLOCK_ITEM_TYPE_ID = ResourceLocation("notenoughupdates", "skyblockitems")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerEntryTypes(registry: EntryTypeRegistry) {
|
override fun registerEntryTypes(registry: EntryTypeRegistry) {
|
||||||
registry.register(SKYBLOCK_ITEM_TYPE_ID, SBItemEntryDefinition)
|
registry.register(SKYBLOCK_ITEM_TYPE_ID, SBItemEntryDefinition)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package moe.nea.notenoughupdates.rei
|
|||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import io.github.moulberry.repo.data.NEUItem
|
import io.github.moulberry.repo.data.NEUItem
|
||||||
import me.shedaniel.math.Point
|
|
||||||
import me.shedaniel.math.Rectangle
|
import me.shedaniel.math.Rectangle
|
||||||
import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer
|
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.Tooltip
|
||||||
@@ -24,7 +23,7 @@ import java.util.stream.Stream
|
|||||||
|
|
||||||
object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
||||||
override fun equals(o1: NEUItem?, o2: NEUItem?, context: ComparisonContext?): Boolean {
|
override fun equals(o1: NEUItem?, o2: NEUItem?, context: ComparisonContext?): Boolean {
|
||||||
return o1 == o2
|
return o1 === o2
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cheatsAs(entry: EntryStack<NEUItem>?, value: NEUItem?): ItemStack? {
|
override fun cheatsAs(entry: EntryStack<NEUItem>?, value: NEUItem?): ItemStack? {
|
||||||
@@ -71,7 +70,7 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun hash(entry: EntryStack<NEUItem>, value: NEUItem, context: ComparisonContext): Long {
|
override fun hash(entry: EntryStack<NEUItem>, value: NEUItem, context: ComparisonContext): Long {
|
||||||
return value.skyblockItemId.hashCode().toLong()
|
return System.identityHashCode(value) * 31L
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun wildcard(entry: EntryStack<NEUItem>, value: NEUItem): NEUItem {
|
override fun wildcard(entry: EntryStack<NEUItem>, value: NEUItem): NEUItem {
|
||||||
|
|||||||
@@ -21,7 +21,13 @@
|
|||||||
"value": "moe.nea.notenoughupdates.NotEnoughUpdates"
|
"value": "moe.nea.notenoughupdates.NotEnoughUpdates"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rei": [
|
"client": [
|
||||||
|
{
|
||||||
|
"adapter": "kotlin",
|
||||||
|
"value": "moe.nea.notenoughupdates.NotEnoughUpdates"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rei_client": [
|
||||||
"moe.nea.notenoughupdates.rei.NEUReiPlugin"
|
"moe.nea.notenoughupdates.rei.NEUReiPlugin"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user