aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/util/MC.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-08-09 00:49:36 +0200
committerLinnea Gräf <nea@nea.moe>2024-08-09 02:20:41 +0200
commit1606188d9ad65c66e9d873497ea3271dbdadaf77 (patch)
treea33ea87c76bd672fe3902455742ba42ae8c91ee1 /src/main/kotlin/moe/nea/firmament/util/MC.kt
parent2a023d0a8d4e9af1dff21ea1bc997dfa0c686b14 (diff)
downloadFirmament-1606188d9ad65c66e9d873497ea3271dbdadaf77.tar.gz
Firmament-1606188d9ad65c66e9d873497ea3271dbdadaf77.tar.bz2
Firmament-1606188d9ad65c66e9d873497ea3271dbdadaf77.zip
Add custom block textures
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/MC.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/MC.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/MC.kt b/src/main/kotlin/moe/nea/firmament/util/MC.kt
index 8935766..b0d3056 100644
--- a/src/main/kotlin/moe/nea/firmament/util/MC.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/MC.kt
@@ -1,11 +1,10 @@
-
-
package moe.nea.firmament.util
import io.github.moulberry.repo.data.Coordinate
import java.util.concurrent.ConcurrentLinkedQueue
import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.screen.ingame.HandledScreen
+import net.minecraft.client.render.WorldRenderer
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket
import net.minecraft.registry.BuiltinRegistries
import net.minecraft.registry.RegistryKeys
@@ -24,6 +23,9 @@ object MC {
while (true) {
inGameHud.chatHud.addMessage(messageQueue.poll() ?: break)
}
+ while (true) {
+ (nextTickTodos.poll() ?: break).invoke()
+ }
}
}
@@ -58,7 +60,14 @@ object MC {
instance.send(block)
}
+ private val nextTickTodos = ConcurrentLinkedQueue<() -> Unit>()
+ fun nextTick(function: () -> Unit) {
+ nextTickTodos.add(function)
+ }
+
+
inline val resourceManager get() = (instance.resourceManager as ReloadableResourceManagerImpl)
+ inline val worldRenderer: WorldRenderer get() = instance.worldRenderer
inline val networkHandler get() = player?.networkHandler
inline val instance get() = MinecraftClient.getInstance()
inline val keyboard get() = instance.keyboard