Switch to yarn mappings
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# architectury-template-kotlin-dsl
|
## NotEnoughUpdates 1.19
|
||||||
architectury template with kotlin-dsl
|
|
||||||
|
|
||||||
Based on [Architectury-templates(1.18.2-forge-fabric-quilt-mixin)](https://github.com/architectury/architectury-templates/releases)
|
> This is still very much more of a tech demo, than an actual usable project. Please do not confuse it for one.
|
||||||
|
|
||||||
|
### Building your own
|
||||||
|
|
||||||
If you find bugs, please open a issues or PR to help me fix bugs.
|
|
||||||
@@ -7,8 +7,9 @@ plugins {
|
|||||||
kotlin("plugin.serialization") version "1.7.10"
|
kotlin("plugin.serialization") version "1.7.10"
|
||||||
id("dev.architectury.loom") version "0.12.0.+"
|
id("dev.architectury.loom") version "0.12.0.+"
|
||||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||||
id("moe.nea.licenseextractificator") version "0.0.1"
|
id("moe.nea.licenseextractificator") version "fffc76c"
|
||||||
id("com.github.eutro.hierarchical-lang") version "1.1.3"
|
id("com.github.eutro.hierarchical-lang") version "1.1.3"
|
||||||
|
id("io.github.juuxel.loom-quiltflower") version "1.7.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@@ -52,7 +53,7 @@ val transInclude by configurations.creating {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// Minecraft dependencies
|
// Minecraft dependencies
|
||||||
"minecraft"("com.mojang:minecraft:${project.property("minecraft_version")}")
|
"minecraft"("com.mojang:minecraft:${project.property("minecraft_version")}")
|
||||||
"mappings"(loom.officialMojangMappings())
|
"mappings"("net.fabricmc:yarn:${project.property("yarn_version")}:v2")
|
||||||
|
|
||||||
// Fabric dependencies
|
// Fabric dependencies
|
||||||
modImplementation("net.fabricmc:fabric-loader:${project.property("fabric_loader_version")}")
|
modImplementation("net.fabricmc:fabric-loader:${project.property("fabric_loader_version")}")
|
||||||
@@ -130,7 +131,7 @@ tasks.processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.create<moe.nea.licenseextractificator.LicenseDiscoveryTask>("license") {
|
tasks.license {
|
||||||
scanConfiguration(project.configurations.compileClasspath.get())
|
scanConfiguration(project.configurations.compileClasspath.get())
|
||||||
outputFile.set(file("$buildDir/LICENSES.json"))
|
outputFile.set(file("$buildDir/LICENSES.json"))
|
||||||
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
|
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
|
||||||
|
|||||||
@@ -12,6 +12,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
|
fabric_kotlin_version=1.8.2+kotlin.1.7.10
|
||||||
|
yarn_version=1.19.2+build.8
|
||||||
|
|
||||||
libgui_version=6.0.0+1.19
|
libgui_version=6.0.0+1.19
|
||||||
rei_version=9.1.518
|
rei_version=9.1.518
|
||||||
|
|||||||
@@ -13,8 +13,19 @@ pluginManagement {
|
|||||||
name = "forgemc"
|
name = "forgemc"
|
||||||
url = uri("https://maven.minecraftforge.net/")
|
url = uri("https://maven.minecraftforge.net/")
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "jitpack"
|
||||||
|
url = uri("https://jitpack.io")
|
||||||
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
|
resolutionStrategy {
|
||||||
|
eachPlugin {
|
||||||
|
when (requested.id.id) {
|
||||||
|
"moe.nea.licenseextractificator" -> useModule("com.github.romangraef:neaslicenseextractificator:${requested.version}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "NotEnoughApdates"
|
rootProject.name = "NotEnoughApdates"
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
|
|||||||
import net.fabricmc.loader.api.FabricLoader
|
import net.fabricmc.loader.api.FabricLoader
|
||||||
import net.fabricmc.loader.api.Version
|
import net.fabricmc.loader.api.Version
|
||||||
import net.fabricmc.loader.api.metadata.ModMetadata
|
import net.fabricmc.loader.api.metadata.ModMetadata
|
||||||
import net.minecraft.commands.CommandBuildContext
|
import net.minecraft.command.CommandRegistryAccess
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.text.Text
|
||||||
import org.apache.logging.log4j.LogManager
|
import org.apache.logging.log4j.LogManager
|
||||||
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
|
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@@ -68,16 +68,16 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
|
|||||||
private fun registerCommands(
|
private fun registerCommands(
|
||||||
dispatcher: CommandDispatcher<FabricClientCommandSource>,
|
dispatcher: CommandDispatcher<FabricClientCommandSource>,
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
_ctx: CommandBuildContext
|
_ctx: CommandRegistryAccess
|
||||||
) {
|
) {
|
||||||
dispatcher.register(ClientCommandManager.literal("neureload")
|
dispatcher.register(ClientCommandManager.literal("neureload")
|
||||||
.then(ClientCommandManager.literal("fetch").executes {
|
.then(ClientCommandManager.literal("fetch").executes {
|
||||||
it.source.sendFeedback(Component.literal("Trying to redownload the repository")) // TODO better reporting
|
it.source.sendFeedback(Text.literal("Trying to redownload the repository")) // TODO better reporting
|
||||||
RepoManager.launchAsyncUpdate()
|
RepoManager.launchAsyncUpdate()
|
||||||
Command.SINGLE_SUCCESS
|
Command.SINGLE_SUCCESS
|
||||||
})
|
})
|
||||||
.executes {
|
.executes {
|
||||||
it.source.sendFeedback(Component.translatable("notenoughupdates.repo.reload.disk"))
|
it.source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
|
||||||
RepoManager.reload()
|
RepoManager.reload()
|
||||||
Command.SINGLE_SUCCESS
|
Command.SINGLE_SUCCESS
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package moe.nea.notenoughupdates.events
|
|||||||
|
|
||||||
import moe.nea.notenoughupdates.events.NEUScreenEvents.OnScreenOpen
|
import moe.nea.notenoughupdates.events.NEUScreenEvents.OnScreenOpen
|
||||||
import net.fabricmc.fabric.api.event.EventFactory
|
import net.fabricmc.fabric.api.event.EventFactory
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screen.Screen
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.MinecraftClient
|
||||||
|
|
||||||
object NEUScreenEvents {
|
object NEUScreenEvents {
|
||||||
fun interface OnScreenOpen {
|
fun interface OnScreenOpen {
|
||||||
/**
|
/**
|
||||||
* Called when a new Screen is opened via [Minecraft.setScreen]. If [new] is null, this corresponds to closing a [Screen].
|
* Called when a new Screen is opened via [MinecraftClient.setScreen]. If [new] is null, this corresponds to closing a [Screen].
|
||||||
* @return true to prevent this event from happening.
|
* @return true to prevent this event from happening.
|
||||||
*/
|
*/
|
||||||
fun onScreenOpen(old: Screen?, new: Screen?): Boolean
|
fun onScreenOpen(old: Screen?, new: Screen?): Boolean
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import io.github.cottonmc.cotton.gui.widget.data.Insets
|
|||||||
import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment
|
import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment
|
||||||
import moe.nea.notenoughupdates.NotEnoughUpdates
|
import moe.nea.notenoughupdates.NotEnoughUpdates
|
||||||
import moe.nea.notenoughupdates.util.ConfigHolder
|
import moe.nea.notenoughupdates.util.ConfigHolder
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.text.Text
|
||||||
import kotlin.reflect.KMutableProperty1
|
import kotlin.reflect.KMutableProperty1
|
||||||
|
|
||||||
class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Unit) : LightweightGuiDescription() {
|
class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Unit) : LightweightGuiDescription() {
|
||||||
@@ -24,48 +24,48 @@ class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Un
|
|||||||
reload()
|
reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun title(component: Component) {
|
fun title(text: Text) {
|
||||||
if (col != 0) {
|
if (col != 0) {
|
||||||
NotEnoughUpdates.logger.warn("Set title not at the top of the ConfigGui")
|
NotEnoughUpdates.logger.warn("Set title not at the top of the ConfigGui")
|
||||||
}
|
}
|
||||||
val label = WLabel(component)
|
val label = WLabel(text)
|
||||||
label.verticalAlignment = VerticalAlignment.TOP
|
label.verticalAlignment = VerticalAlignment.TOP
|
||||||
label.horizontalAlignment = HorizontalAlignment.CENTER
|
label.horizontalAlignment = HorizontalAlignment.CENTER
|
||||||
root.add(label, 0, col, 11, 1)
|
root.add(label, 0, col, 11, 1)
|
||||||
col++
|
col++
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun label(component: Component) {
|
private fun label(text: Text) {
|
||||||
val label = WLabel(component)
|
val label = WLabel(text)
|
||||||
label.verticalAlignment = VerticalAlignment.CENTER
|
label.verticalAlignment = VerticalAlignment.CENTER
|
||||||
root.add(label, 0, col, 5, 1)
|
root.add(label, 0, col, 5, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggle(component: Component, prop: KMutableProperty1<K, Boolean>) {
|
fun toggle(text: Text, prop: KMutableProperty1<K, Boolean>) {
|
||||||
val toggle = WToggleButton(component)
|
val toggle = WToggleButton(text)
|
||||||
reloadables.add { toggle.toggle = prop.get(holder.config) }
|
reloadables.add { toggle.toggle = prop.get(holder.config) }
|
||||||
toggle.setOnToggle {
|
toggle.setOnToggle {
|
||||||
prop.set(holder.config, true)
|
prop.set(holder.config, true)
|
||||||
holder.markDirty()
|
holder.markDirty()
|
||||||
}
|
}
|
||||||
root.add(toggle, 5, col, 6, 1)
|
root.add(toggle, 5, col, 6, 1)
|
||||||
label(component)
|
label(text)
|
||||||
col++
|
col++
|
||||||
}
|
}
|
||||||
|
|
||||||
fun button(component: Component, buttonText: Component, runnable: () -> Unit) {
|
fun button(text: Text, buttonText: Text, runnable: () -> Unit) {
|
||||||
val button = WButton(buttonText)
|
val button = WButton(buttonText)
|
||||||
button.setOnClick {
|
button.setOnClick {
|
||||||
runnable.invoke()
|
runnable.invoke()
|
||||||
}
|
}
|
||||||
root.add(button, 5, col, 6, 1)
|
root.add(button, 5, col, 6, 1)
|
||||||
label(component)
|
label(text)
|
||||||
col++
|
col++
|
||||||
}
|
}
|
||||||
|
|
||||||
fun textfield(
|
fun textfield(
|
||||||
component: Component,
|
text: Text,
|
||||||
background: Component,
|
background: Text,
|
||||||
prop: KMutableProperty1<K, String>,
|
prop: KMutableProperty1<K, String>,
|
||||||
maxLength: Int = 255
|
maxLength: Int = 255
|
||||||
) {
|
) {
|
||||||
@@ -80,7 +80,7 @@ class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Un
|
|||||||
holder.markDirty()
|
holder.markDirty()
|
||||||
}
|
}
|
||||||
root.add(textfield, 5, col, 6, 11)
|
root.add(textfield, 5, col, 6, 11)
|
||||||
label(component)
|
label(text)
|
||||||
col++
|
col++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
package moe.nea.notenoughupdates.gui
|
package moe.nea.notenoughupdates.gui
|
||||||
|
|
||||||
import moe.nea.notenoughupdates.repo.RepoManager
|
import moe.nea.notenoughupdates.repo.RepoManager
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.text.Text
|
||||||
|
|
||||||
fun repoGui(): ConfigGui<RepoManager.Config> {
|
fun repoGui(): ConfigGui<RepoManager.Config> {
|
||||||
return ConfigGui(RepoManager) {
|
return ConfigGui(RepoManager) {
|
||||||
title(Component.literal("NotEnoughUpdates Repo Settings"))
|
title(Text.literal("NotEnoughUpdates Repo Settings"))
|
||||||
toggle(Component.literal("Auto Update"), RepoManager.Config::autoUpdate)
|
toggle(Text.literal("Auto Update"), RepoManager.Config::autoUpdate)
|
||||||
textfield(
|
textfield(
|
||||||
Component.literal("Repo Username"),
|
Text.literal("Repo Username"),
|
||||||
Component.literal("<github user>"),
|
Text.literal("<github user>"),
|
||||||
RepoManager.Config::user,
|
RepoManager.Config::user,
|
||||||
maxLength = 255
|
maxLength = 255
|
||||||
)
|
)
|
||||||
textfield(
|
textfield(
|
||||||
Component.literal("Repo Name"),
|
Text.literal("Repo Name"),
|
||||||
Component.literal("<repo name>"),
|
Text.literal("<repo name>"),
|
||||||
RepoManager.Config::repo
|
RepoManager.Config::repo
|
||||||
)
|
)
|
||||||
textfield(
|
textfield(
|
||||||
Component.literal("Repo Branch"),
|
Text.literal("Repo Branch"),
|
||||||
Component.literal("<repo branch>"),
|
Text.literal("<repo branch>"),
|
||||||
RepoManager.Config::branch
|
RepoManager.Config::branch
|
||||||
)
|
)
|
||||||
button(
|
button(
|
||||||
Component.literal("Reset to Defaults"),
|
Text.literal("Reset to Defaults"),
|
||||||
Component.literal("Reset"),
|
Text.literal("Reset"),
|
||||||
) {
|
) {
|
||||||
RepoManager.config.user = "NotEnoughUpdates"
|
RepoManager.config.user = "NotEnoughUpdates"
|
||||||
RepoManager.config.repo = "NotEnoughUpdates-REPO"
|
RepoManager.config.repo = "NotEnoughUpdates-REPO"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package moe.nea.notenoughupdates.hud
|
package moe.nea.notenoughupdates.hud
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
|
||||||
import io.github.cottonmc.cotton.gui.client.ScreenDrawing
|
import io.github.cottonmc.cotton.gui.client.ScreenDrawing
|
||||||
import io.github.cottonmc.cotton.gui.widget.WWidget
|
import io.github.cottonmc.cotton.gui.widget.WWidget
|
||||||
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment
|
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment
|
||||||
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
||||||
|
import net.minecraft.client.util.math.MatrixStack
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ class ProgressBar(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun paint(matrices: PoseStack, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
override fun paint(matrices: MatrixStack, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
||||||
ScreenDrawing.coloredRect(matrices, x, y, width, height, 0xFF808080.toInt())
|
ScreenDrawing.coloredRect(matrices, x, y, width, height, 0xFF808080.toInt())
|
||||||
val (l, prog) = synchronized(this) {
|
val (l, prog) = synchronized(this) {
|
||||||
label to (progress to total)
|
label to (progress to total)
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package moe.nea.notenoughupdates.mixins
|
package moe.nea.notenoughupdates.mixins
|
||||||
|
|
||||||
import moe.nea.notenoughupdates.events.NEUScreenEvents
|
import moe.nea.notenoughupdates.events.NEUScreenEvents
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screen.Screen
|
||||||
import org.spongepowered.asm.mixin.Mixin
|
import org.spongepowered.asm.mixin.Mixin
|
||||||
import org.spongepowered.asm.mixin.injection.At
|
import org.spongepowered.asm.mixin.injection.At
|
||||||
import org.spongepowered.asm.mixin.injection.Inject
|
import org.spongepowered.asm.mixin.injection.Inject
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
|
||||||
|
|
||||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||||
@Mixin(Minecraft::class)
|
@Mixin(MinecraftClient::class)
|
||||||
class MixinMinecraft {
|
class MixinMinecraft {
|
||||||
@Inject(method = ["setScreen"], at = [At("HEAD")], cancellable = true)
|
@Inject(method = ["setScreen"], at = [At("HEAD")], cancellable = true)
|
||||||
fun momo(screen: Screen?, ci: CallbackInfo) {
|
fun onScreenChange(screen: Screen?, ci: CallbackInfo) {
|
||||||
if (NEUScreenEvents.SCREEN_OPEN.invoker().onScreenOpen((this as Minecraft).screen, screen))
|
if (NEUScreenEvents.SCREEN_OPEN.invoker().onScreenOpen((this as MinecraftClient).currentScreen, screen))
|
||||||
ci.cancel()
|
ci.cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,19 +8,18 @@ import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry
|
|||||||
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes
|
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes
|
||||||
import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
|
import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
|
||||||
import moe.nea.notenoughupdates.repo.RepoManager
|
import moe.nea.notenoughupdates.repo.RepoManager
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.util.Identifier
|
||||||
|
|
||||||
|
|
||||||
class NEUReiPlugin : REIClientPlugin {
|
class NEUReiPlugin : REIClientPlugin {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun EntryStack<NEUItem>.asItemEntry(): EntryStack<ItemStack> {
|
fun EntryStack<NEUItem>.asItemEntry(): EntryStack<ItemStack> {
|
||||||
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 = Identifier("notenoughupdates", "skyblockitems")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun registerEntryTypes(registry: EntryTypeRegistry) {
|
override fun registerEntryTypes(registry: EntryTypeRegistry) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package moe.nea.notenoughupdates.rei
|
package moe.nea.notenoughupdates.rei
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
|
||||||
import io.github.moulberry.repo.data.NEUItem
|
import io.github.moulberry.repo.data.NEUItem
|
||||||
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
|
||||||
@@ -14,11 +13,12 @@ import me.shedaniel.rei.api.common.entry.type.EntryType
|
|||||||
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes
|
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes
|
||||||
import moe.nea.notenoughupdates.rei.NEUReiPlugin.Companion.asItemEntry
|
import moe.nea.notenoughupdates.rei.NEUReiPlugin.Companion.asItemEntry
|
||||||
import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
|
import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
|
||||||
import moe.nea.notenoughupdates.repo.ItemCache.getResourceLocation
|
import moe.nea.notenoughupdates.repo.ItemCache.getIdentifier
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.client.util.math.MatrixStack
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.tags.TagKey
|
import net.minecraft.tag.TagKey
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.text.Text
|
||||||
|
import net.minecraft.util.Identifier
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
|
||||||
object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
||||||
@@ -37,7 +37,7 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
|||||||
override fun getRenderer(): EntryRenderer<NEUItem> = object : EntryRenderer<NEUItem> {
|
override fun getRenderer(): EntryRenderer<NEUItem> = object : EntryRenderer<NEUItem> {
|
||||||
override fun render(
|
override fun render(
|
||||||
entry: EntryStack<NEUItem>,
|
entry: EntryStack<NEUItem>,
|
||||||
matrices: PoseStack,
|
matrices: MatrixStack,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
mouseX: Int,
|
mouseX: Int,
|
||||||
mouseY: Int,
|
mouseY: Int,
|
||||||
@@ -65,7 +65,7 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
|||||||
return Stream.empty()
|
return Stream.empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun asFormattedText(entry: EntryStack<NEUItem>, value: NEUItem): Component {
|
override fun asFormattedText(entry: EntryStack<NEUItem>, value: NEUItem): Text {
|
||||||
return VanillaEntryTypes.ITEM.definition.asFormattedText(entry.asItemEntry(), value.asItemStack())
|
return VanillaEntryTypes.ITEM.definition.asFormattedText(entry.asItemEntry(), value.asItemStack())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +89,8 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIdentifier(entry: EntryStack<NEUItem>?, value: NEUItem): ResourceLocation {
|
override fun getIdentifier(entry: EntryStack<NEUItem>?, value: NEUItem): Identifier {
|
||||||
return value.getResourceLocation()
|
return value.getIdentifier()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,36 +10,36 @@ import kotlinx.coroutines.launch
|
|||||||
import moe.nea.notenoughupdates.NotEnoughUpdates
|
import moe.nea.notenoughupdates.NotEnoughUpdates
|
||||||
import moe.nea.notenoughupdates.util.LegacyTagParser
|
import moe.nea.notenoughupdates.util.LegacyTagParser
|
||||||
import moe.nea.notenoughupdates.util.appendLore
|
import moe.nea.notenoughupdates.util.appendLore
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.datafixer.Schemas
|
||||||
|
import net.minecraft.datafixer.TypeReferences
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.item.Items
|
||||||
|
import net.minecraft.nbt.NbtCompound
|
||||||
import net.minecraft.nbt.NbtOps
|
import net.minecraft.nbt.NbtOps
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.text.Text
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.datafix.DataFixers
|
|
||||||
import net.minecraft.util.datafix.fixes.References
|
|
||||||
import net.minecraft.world.item.ItemStack
|
|
||||||
import net.minecraft.world.item.Items
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
object ItemCache : IReloadable {
|
object ItemCache : IReloadable {
|
||||||
val cache: MutableMap<String, ItemStack> = ConcurrentHashMap()
|
val cache: MutableMap<String, ItemStack> = ConcurrentHashMap()
|
||||||
val df = DataFixers.getDataFixer()
|
val df = Schemas.getFixer()
|
||||||
var isFlawless = true
|
var isFlawless = true
|
||||||
|
|
||||||
private fun NEUItem.get10809CompoundTag(): CompoundTag = CompoundTag().apply {
|
private fun NEUItem.get10809CompoundTag(): NbtCompound = NbtCompound().apply {
|
||||||
put("tag", LegacyTagParser.parse(nbttag))
|
put("tag", LegacyTagParser.parse(nbttag))
|
||||||
putString("id", minecraftItemId)
|
putString("id", minecraftItemId)
|
||||||
putByte("Count", 1)
|
putByte("Count", 1)
|
||||||
putShort("Damage", damage.toShort())
|
putShort("Damage", damage.toShort())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CompoundTag.transformFrom10809ToModern(): CompoundTag? =
|
private fun NbtCompound.transformFrom10809ToModern(): NbtCompound? =
|
||||||
try {
|
try {
|
||||||
df.update(
|
df.update(
|
||||||
References.ITEM_STACK,
|
TypeReferences.ITEM_STACK,
|
||||||
Dynamic(NbtOps.INSTANCE, this),
|
Dynamic(NbtOps.INSTANCE, this),
|
||||||
-1,
|
-1,
|
||||||
2975
|
2975
|
||||||
).value as CompoundTag
|
).value as NbtCompound
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
NotEnoughUpdates.logger.error("Failed to datafixer an item", e)
|
NotEnoughUpdates.logger.error("Failed to datafixer an item", e)
|
||||||
isFlawless = false
|
isFlawless = false
|
||||||
@@ -50,12 +50,12 @@ object ItemCache : IReloadable {
|
|||||||
val oldItemTag = get10809CompoundTag()
|
val oldItemTag = get10809CompoundTag()
|
||||||
val modernItemTag = oldItemTag.transformFrom10809ToModern()
|
val modernItemTag = oldItemTag.transformFrom10809ToModern()
|
||||||
?: return ItemStack(Items.PAINTING).apply {
|
?: return ItemStack(Items.PAINTING).apply {
|
||||||
hoverName = Component.literal(this@asItemStackNow.displayName)
|
setCustomName(Text.literal(this@asItemStackNow.displayName))
|
||||||
appendLore(listOf(Component.literal("Exception rendering item: $skyblockItemId")))
|
appendLore(listOf(Text.literal("Exception rendering item: $skyblockItemId")))
|
||||||
}
|
}
|
||||||
val itemInstance = ItemStack.of(modernItemTag)
|
val itemInstance = ItemStack.fromNbt(modernItemTag)
|
||||||
if (itemInstance.tag?.contains("Enchantments") == true) {
|
if (itemInstance.nbt?.contains("Enchantments") == true) {
|
||||||
itemInstance.enchantmentTags.add(CompoundTag())
|
itemInstance.enchantments.add(NbtCompound())
|
||||||
}
|
}
|
||||||
return itemInstance
|
return itemInstance
|
||||||
}
|
}
|
||||||
@@ -69,8 +69,8 @@ object ItemCache : IReloadable {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
fun NEUItem.getResourceLocation() =
|
fun NEUItem.getIdentifier() =
|
||||||
ResourceLocation("skyblockitem", skyblockItemId.lowercase().replace(";", "__"))
|
Identifier("skyblockitem", skyblockItemId.lowercase().replace(";", "__"))
|
||||||
|
|
||||||
|
|
||||||
var job: Job? = null
|
var job: Job? = null
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import moe.nea.notenoughupdates.NotEnoughUpdates.logger
|
|||||||
import moe.nea.notenoughupdates.hud.ProgressBar
|
import moe.nea.notenoughupdates.hud.ProgressBar
|
||||||
import moe.nea.notenoughupdates.util.ConfigHolder
|
import moe.nea.notenoughupdates.util.ConfigHolder
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket
|
||||||
import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket
|
import net.minecraft.text.Text
|
||||||
|
|
||||||
object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Config) {
|
object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Config) {
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -43,8 +43,8 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun trySendClientboundUpdateRecipesPacket(): Boolean {
|
private fun trySendClientboundUpdateRecipesPacket(): Boolean {
|
||||||
return Minecraft.getInstance().level != null && Minecraft.getInstance().connection?.handleUpdateRecipes(
|
return MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().networkHandler?.onSynchronizeRecipes(
|
||||||
ClientboundUpdateRecipesPacket(mutableListOf())
|
SynchronizeRecipesS2CPacket(mutableListOf())
|
||||||
) != null
|
) != null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co
|
|||||||
CottonHud.add(progressBar)
|
CottonHud.add(progressBar)
|
||||||
neuRepo.reload()
|
neuRepo.reload()
|
||||||
} catch (exc: NEURepositoryException) {
|
} catch (exc: NEURepositoryException) {
|
||||||
Minecraft.getInstance().player?.sendSystemMessage(
|
MinecraftClient.getInstance().player?.sendMessage(
|
||||||
Component.literal("Failed to reload repository. This will result in some mod features not working.")
|
Text.literal("Failed to reload repository. This will result in some mod features not working.")
|
||||||
)
|
)
|
||||||
CottonHud.remove(progressBar)
|
CottonHud.remove(progressBar)
|
||||||
exc.printStackTrace()
|
exc.printStackTrace()
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import kotlinx.serialization.SerializationException
|
|||||||
import moe.nea.notenoughupdates.NotEnoughUpdates
|
import moe.nea.notenoughupdates.NotEnoughUpdates
|
||||||
import moe.nea.notenoughupdates.events.NEUScreenEvents
|
import moe.nea.notenoughupdates.events.NEUScreenEvents
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.commands.CommandSource
|
import net.minecraft.command.CommandSource
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.server.command.CommandOutput
|
||||||
|
import net.minecraft.text.Text
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.concurrent.CopyOnWriteArrayList
|
import java.util.concurrent.CopyOnWriteArrayList
|
||||||
@@ -102,10 +103,10 @@ abstract class ConfigHolder<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun warnForResetConfigs(player: CommandSource) {
|
private fun warnForResetConfigs(player: CommandOutput) {
|
||||||
if (badLoads.isNotEmpty()) {
|
if (badLoads.isNotEmpty()) {
|
||||||
player.sendSystemMessage(
|
player.sendMessage(
|
||||||
Component.literal(
|
Text.literal(
|
||||||
"The following configs have been reset: ${badLoads.joinToString(", ")}. " +
|
"The following configs have been reset: ${badLoads.joinToString(", ")}. " +
|
||||||
"This can be intentional, but probably isn't."
|
"This can be intentional, but probably isn't."
|
||||||
)
|
)
|
||||||
@@ -117,7 +118,7 @@ abstract class ConfigHolder<T>(
|
|||||||
fun registerEvents() {
|
fun registerEvents() {
|
||||||
NEUScreenEvents.SCREEN_OPEN.register(NEUScreenEvents.OnScreenOpen { old, new ->
|
NEUScreenEvents.SCREEN_OPEN.register(NEUScreenEvents.OnScreenOpen { old, new ->
|
||||||
performSaves()
|
performSaves()
|
||||||
val p = Minecraft.getInstance().player
|
val p = MinecraftClient.getInstance().player
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
warnForResetConfigs(p)
|
warnForResetConfigs(p)
|
||||||
}
|
}
|
||||||
@@ -128,6 +129,5 @@ abstract class ConfigHolder<T>(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,24 @@
|
|||||||
package moe.nea.notenoughupdates.util
|
package moe.nea.notenoughupdates.util
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.ListTag
|
import net.minecraft.nbt.NbtCompound
|
||||||
import net.minecraft.nbt.StringTag
|
import net.minecraft.nbt.NbtList
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.nbt.NbtString
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.text.Text
|
||||||
|
|
||||||
fun ItemStack.appendLore(args: List<Component>) {
|
|
||||||
val compoundTag = getOrCreateTagElement("display")
|
fun ItemStack.appendLore(args: List<Text>) {
|
||||||
val loreList = compoundTag.getOrCreateList("Lore", StringTag.TAG_STRING)
|
val compoundTag = getOrCreateSubNbt("display")
|
||||||
|
val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE)
|
||||||
for (arg in args) {
|
for (arg in args) {
|
||||||
loreList.add(StringTag.valueOf(Component.Serializer.toJson(arg)))
|
loreList.add(NbtString.of(Text.Serializer.toJson(arg)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CompoundTag.getOrCreateList(label: String, tag: Byte): ListTag = getList(label, tag.toInt()).also {
|
fun NbtCompound.getOrCreateList(label: String, tag: Byte): NbtList = getList(label, tag.toInt()).also {
|
||||||
put(label, it)
|
put(label, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CompoundTag.getOrCreateCompoundTag(label: String): CompoundTag = getCompound(label).also {
|
fun NbtCompound.getOrCreateCompoundTag(label: String): NbtCompound = getCompound(label).also {
|
||||||
put(label, it)
|
put(label, it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val digitRange = '0'..'9'
|
val digitRange = '0'..'9'
|
||||||
fun parse(string: String): CompoundTag {
|
fun parse(string: String): NbtCompound {
|
||||||
return LegacyTagParser(string).baseTag
|
return LegacyTagParser(string).baseTag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,11 +90,11 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
racer.consumeWhile { Character.isWhitespace(it.last()) } // Only check last since other chars are always checked before.
|
racer.consumeWhile { Character.isWhitespace(it.last()) } // Only check last since other chars are always checked before.
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseTag(): CompoundTag {
|
fun parseTag(): NbtCompound {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
racer.expect("{", "Expected '{’ at start of tag")
|
racer.expect("{", "Expected '{’ at start of tag")
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
val tag = CompoundTag()
|
val tag = NbtCompound()
|
||||||
while (!racer.tryConsume("}")) {
|
while (!racer.tryConsume("}")) {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
val lhs = parseIdentifier()
|
val lhs = parseIdentifier()
|
||||||
@@ -109,7 +109,7 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseAny(): Tag {
|
private fun parseAny(): NbtElement {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
val nextChar = racer.peekReq(1) ?: racer.error("Expected new object, found EOF")
|
val nextChar = racer.peekReq(1) ?: racer.error("Expected new object, found EOF")
|
||||||
return when {
|
return when {
|
||||||
@@ -121,11 +121,11 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseList(): ListTag {
|
fun parseList(): NbtList {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
racer.expect("[", "Expected '[' at start of tag")
|
racer.expect("[", "Expected '[' at start of tag")
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
val list = ListTag()
|
val list = NbtList()
|
||||||
while (!racer.tryConsume("]")) {
|
while (!racer.tryConsume("]")) {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
racer.pushState()
|
racer.pushState()
|
||||||
@@ -170,8 +170,8 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseStringTag(): StringTag {
|
fun parseStringTag(): NbtString {
|
||||||
return StringTag.valueOf(parseQuotedString())
|
return NbtString.of(parseQuotedString())
|
||||||
}
|
}
|
||||||
|
|
||||||
object Patterns {
|
object Patterns {
|
||||||
@@ -185,7 +185,7 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
val ROUGH_PATTERN = "[-+]?[0-9]*\\.?[0-9]+[dDbBfFlLsS]?".toRegex()
|
val ROUGH_PATTERN = "[-+]?[0-9]*\\.?[0-9]+[dDbBfFlLsS]?".toRegex()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseNumericTag(): NumericTag {
|
fun parseNumericTag(): AbstractNbtNumber {
|
||||||
skipWhitespace()
|
skipWhitespace()
|
||||||
val textForm = racer.consumeWhile { Patterns.ROUGH_PATTERN.matchEntire(it) != null }
|
val textForm = racer.consumeWhile { Patterns.ROUGH_PATTERN.matchEntire(it) != null }
|
||||||
if (textForm.isEmpty()) {
|
if (textForm.isEmpty()) {
|
||||||
@@ -193,27 +193,27 @@ class LegacyTagParser private constructor(string: String) {
|
|||||||
}
|
}
|
||||||
val doubleMatch = Patterns.DOUBLE.matchEntire(textForm) ?: Patterns.DOUBLE_UNTYPED.matchEntire(textForm)
|
val doubleMatch = Patterns.DOUBLE.matchEntire(textForm) ?: Patterns.DOUBLE_UNTYPED.matchEntire(textForm)
|
||||||
if (doubleMatch != null) {
|
if (doubleMatch != null) {
|
||||||
return DoubleTag.valueOf(doubleMatch.groups[1]!!.value.toDouble())
|
return NbtDouble.of(doubleMatch.groups[1]!!.value.toDouble())
|
||||||
}
|
}
|
||||||
val floatMatch = Patterns.FLOAT.matchEntire(textForm)
|
val floatMatch = Patterns.FLOAT.matchEntire(textForm)
|
||||||
if (floatMatch != null) {
|
if (floatMatch != null) {
|
||||||
return FloatTag.valueOf(floatMatch.groups[1]!!.value.toFloat())
|
return NbtFloat.of(floatMatch.groups[1]!!.value.toFloat())
|
||||||
}
|
}
|
||||||
val byteMatch = Patterns.BYTE.matchEntire(textForm)
|
val byteMatch = Patterns.BYTE.matchEntire(textForm)
|
||||||
if (byteMatch != null) {
|
if (byteMatch != null) {
|
||||||
return ByteTag.valueOf(byteMatch.groups[1]!!.value.toByte())
|
return NbtByte.of(byteMatch.groups[1]!!.value.toByte())
|
||||||
}
|
}
|
||||||
val longMatch = Patterns.LONG.matchEntire(textForm)
|
val longMatch = Patterns.LONG.matchEntire(textForm)
|
||||||
if (longMatch != null) {
|
if (longMatch != null) {
|
||||||
return LongTag.valueOf(longMatch.groups[1]!!.value.toLong())
|
return NbtLong.of(longMatch.groups[1]!!.value.toLong())
|
||||||
}
|
}
|
||||||
val shortMatch = Patterns.SHORT.matchEntire(textForm)
|
val shortMatch = Patterns.SHORT.matchEntire(textForm)
|
||||||
if (shortMatch != null) {
|
if (shortMatch != null) {
|
||||||
return ShortTag.valueOf(shortMatch.groups[1]!!.value.toShort())
|
return NbtShort.of(shortMatch.groups[1]!!.value.toShort())
|
||||||
}
|
}
|
||||||
val integerMatch = Patterns.INTEGER.matchEntire(textForm)
|
val integerMatch = Patterns.INTEGER.matchEntire(textForm)
|
||||||
if (integerMatch != null) {
|
if (integerMatch != null) {
|
||||||
return IntTag.valueOf(integerMatch.groups[1]!!.value.toInt())
|
return NbtInt.of(integerMatch.groups[1]!!.value.toInt())
|
||||||
}
|
}
|
||||||
throw IllegalStateException("Could not properly parse numeric tag '$textForm', despite passing rough verification. This is a bug in the LegacyTagParser")
|
throw IllegalStateException("Could not properly parse numeric tag '$textForm', despite passing rough verification. This is a bug in the LegacyTagParser")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,19 @@ package moe.nea.notenoughupdates.util
|
|||||||
|
|
||||||
import moe.nea.notenoughupdates.NotEnoughUpdates
|
import moe.nea.notenoughupdates.NotEnoughUpdates
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.MinecraftClient
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screen.Screen
|
||||||
|
|
||||||
object ScreenUtil {
|
object ScreenUtil {
|
||||||
init {
|
init {
|
||||||
ClientTickEvents.START_CLIENT_TICK.register(::onTick)
|
ClientTickEvents.START_CLIENT_TICK.register(::onTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onTick(minecraft: Minecraft) {
|
private fun onTick(minecraft: MinecraftClient) {
|
||||||
if (nextOpenedGui != null) {
|
if (nextOpenedGui != null) {
|
||||||
val p = minecraft.player
|
val p = minecraft.player
|
||||||
if (p?.containerMenu != null) {
|
if (p?.currentScreenHandler != null) {
|
||||||
p.closeContainer()
|
p.closeHandledScreen()
|
||||||
}
|
}
|
||||||
minecraft.setScreen(nextOpenedGui)
|
minecraft.setScreen(nextOpenedGui)
|
||||||
nextOpenedGui = null
|
nextOpenedGui = null
|
||||||
|
|||||||
Reference in New Issue
Block a user