diff options
Diffstat (limited to 'src/main/kotlin/util/MC.kt')
| -rw-r--r-- | src/main/kotlin/util/MC.kt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt index e85b119..7ab0cbb 100644 --- a/src/main/kotlin/util/MC.kt +++ b/src/main/kotlin/util/MC.kt @@ -1,7 +1,7 @@ package moe.nea.firmament.util import io.github.moulberry.repo.data.Coordinate -import io.github.notenoughupdates.moulconfig.gui.GuiComponentWrapper +import io.github.notenoughupdates.moulconfig.platform.MoulConfigScreenComponent import java.util.concurrent.ConcurrentLinkedQueue import kotlin.jvm.optionals.getOrNull import net.minecraft.client.MinecraftClient @@ -16,11 +16,13 @@ import net.minecraft.client.world.ClientWorld import net.minecraft.entity.Entity import net.minecraft.item.Item import net.minecraft.item.ItemStack +import net.minecraft.nbt.NbtOps import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket import net.minecraft.registry.BuiltinRegistries import net.minecraft.registry.Registry import net.minecraft.registry.RegistryKey import net.minecraft.registry.RegistryKeys +import net.minecraft.registry.RegistryOps import net.minecraft.registry.RegistryWrapper import net.minecraft.resource.ReloadableResourceManagerImpl import net.minecraft.text.Text @@ -74,7 +76,7 @@ object MC { fun sendCommand(command: String) { // TODO: add a queue to this and sendServerChat ErrorUtil.softCheck("Server commands have an implied /", !command.startsWith("/")) - player?.networkHandler?.sendCommand(command) + player?.networkHandler?.sendChatCommand(command) } fun onMainThread(block: () -> Unit) { @@ -117,6 +119,7 @@ object MC { inline val window get() = instance.window inline val currentRegistries: RegistryWrapper.WrapperLookup? get() = world?.registryManager val defaultRegistries: RegistryWrapper.WrapperLookup by lazy { BuiltinRegistries.createWrapperLookup() } + val defaultRegistryNbtOps by lazy { RegistryOps.of(NbtOps.INSTANCE, defaultRegistries) } inline val currentOrDefaultRegistries get() = currentRegistries ?: defaultRegistries val defaultItems: RegistryWrapper.Impl<Item> by lazy { defaultRegistries.getOrThrow(RegistryKeys.ITEM) } var currentTick = 0 @@ -128,7 +131,7 @@ object MC { private set val currentMoulConfigContext - get() = (screen as? GuiComponentWrapper)?.context + get() = (screen as? MoulConfigScreenComponent)?.guiContext fun openUrl(uri: String) { Util.getOperatingSystem().open(uri) |
