aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-03 00:52:37 +0200
committernea <nea@nea.moe>2023-05-03 00:52:49 +0200
commit3be33bb522f468b812bb59b7f2edc8d1ca352661 (patch)
tree1292a52cb661ab71584b1ae248204e18b869afe1 /src/main/kotlin/moe
parenta8ab8f3d6326211f6e07694c64ebd8b6ba195988 (diff)
downloadfirmament-3be33bb522f468b812bb59b7f2edc8d1ca352661.tar.gz
firmament-3be33bb522f468b812bb59b7f2edc8d1ca352661.tar.bz2
firmament-3be33bb522f468b812bb59b7f2edc8d1ca352661.zip
Modernize and 1.19.4ify
Diffstat (limited to 'src/main/kotlin/moe')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/events/WorldRenderLastEvent.kt2
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientBrandRetriever.kt18
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientPlayNetworkHandler.kt17
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMessageHandler.kt33
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt20
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.kt41
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt4
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/util/SBData.kt15
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt4
9 files changed, 5 insertions, 149 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/events/WorldRenderLastEvent.kt b/src/main/kotlin/moe/nea/notenoughupdates/events/WorldRenderLastEvent.kt
index c230c9c..60b7e06 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/events/WorldRenderLastEvent.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/events/WorldRenderLastEvent.kt
@@ -1,10 +1,10 @@
package moe.nea.notenoughupdates.events
+import org.joml.Matrix4f
import net.minecraft.client.render.Camera
import net.minecraft.client.render.GameRenderer
import net.minecraft.client.render.LightmapTextureManager
import net.minecraft.client.util.math.MatrixStack
-import net.minecraft.util.math.Matrix4f
/**
* This event is called after all world rendering is done, but before any GUI rendering (including hand) has been done.
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientBrandRetriever.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientBrandRetriever.kt
deleted file mode 100644
index f5ccf23..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientBrandRetriever.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package moe.nea.notenoughupdates.mixins
-
-import org.spongepowered.asm.mixin.Mixin
-import org.spongepowered.asm.mixin.Overwrite
-import net.minecraft.client.ClientBrandRetriever
-
-@Mixin(ClientBrandRetriever::class)
-class MixinClientBrandRetriever {
-
-private companion object {
- @JvmStatic
- @Overwrite
- fun getClientModName(): String {
- return "penis"
- }
- }
-
-}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientPlayNetworkHandler.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientPlayNetworkHandler.kt
deleted file mode 100644
index b94ff65..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinClientPlayNetworkHandler.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package moe.nea.notenoughupdates.mixins
-
-import org.spongepowered.asm.mixin.Mixin
-import org.spongepowered.asm.mixin.injection.At
-import org.spongepowered.asm.mixin.injection.Inject
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-import net.minecraft.client.network.ClientPlayNetworkHandler
-import net.minecraft.network.packet.s2c.play.PlayerSpawnPositionS2CPacket
-import moe.nea.notenoughupdates.events.WorldReadyEvent
-
-@Mixin(ClientPlayNetworkHandler::class)
-class MixinClientPlayNetworkHandler {
- @Inject(method = ["onPlayerSpawnPosition"], at = [At("RETURN")])
- fun onOnPlayerSpawnPosition(packet: PlayerSpawnPositionS2CPacket, ci: CallbackInfo) {
- WorldReadyEvent.publish(WorldReadyEvent())
- }
-}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMessageHandler.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMessageHandler.kt
deleted file mode 100644
index b6151b9..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMessageHandler.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package moe.nea.notenoughupdates.mixins
-
-import org.spongepowered.asm.mixin.Mixin
-import org.spongepowered.asm.mixin.injection.At
-import org.spongepowered.asm.mixin.injection.Inject
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-import net.minecraft.client.network.message.MessageHandler
-import net.minecraft.network.message.MessageType
-import net.minecraft.network.message.SignedMessage
-import net.minecraft.text.Text
-import moe.nea.notenoughupdates.events.ServerChatLineReceivedEvent
-
-@Mixin(MessageHandler::class)
-class MixinMessageHandler {
- @Inject(method = ["onChatMessage"], at = [At("HEAD")], cancellable = true)
- fun onOnChatMessage(message: SignedMessage, params: MessageType.Parameters, ci: CallbackInfo) {
- val decoratedText = params.applyChatDecoration(message.unsignedContent.orElse(message.content))
- val event = ServerChatLineReceivedEvent(decoratedText)
- if (ServerChatLineReceivedEvent.publish(event).cancelled) {
- ci.cancel()
- }
- }
-
- @Inject(method = ["onGameMessage"], at = [At("HEAD")], cancellable = true)
- fun onOnGameMessage(message: Text, overlay: Boolean, ci: CallbackInfo) {
- if (!overlay) {
- val event = ServerChatLineReceivedEvent(message)
- if (ServerChatLineReceivedEvent.publish(event).cancelled) {
- ci.cancel()
- }
- }
- }
-}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt
deleted file mode 100644
index 3bc1a5f..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinMinecraft.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package moe.nea.notenoughupdates.mixins
-
-import org.spongepowered.asm.mixin.Mixin
-import org.spongepowered.asm.mixin.injection.At
-import org.spongepowered.asm.mixin.injection.Inject
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-import net.minecraft.client.MinecraftClient
-import net.minecraft.client.gui.screen.Screen
-import moe.nea.notenoughupdates.events.ScreenOpenEvent
-
-@Suppress("CAST_NEVER_SUCCEEDS")
-@Mixin(MinecraftClient::class)
-class MixinMinecraft {
- @Inject(method = ["setScreen"], at = [At("HEAD")], cancellable = true)
- fun onScreenChange(screen: Screen?, ci: CallbackInfo) {
- val event = ScreenOpenEvent((this as MinecraftClient).currentScreen, screen)
- if (ScreenOpenEvent.publish(event).cancelled)
- ci.cancel()
- }
-}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.kt b/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.kt
deleted file mode 100644
index ac9ea15..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package moe.nea.notenoughupdates.mixins
-
-import org.spongepowered.asm.mixin.Mixin
-import org.spongepowered.asm.mixin.injection.At
-import org.spongepowered.asm.mixin.injection.Inject
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-import net.minecraft.client.render.Camera
-import net.minecraft.client.render.GameRenderer
-import net.minecraft.client.render.LightmapTextureManager
-import net.minecraft.client.render.WorldRenderer
-import net.minecraft.client.util.math.MatrixStack
-import net.minecraft.util.math.Matrix4f
-import moe.nea.notenoughupdates.events.WorldRenderLastEvent
-
-@Mixin(WorldRenderer::class)
-class MixinWorldRenderer {
-
- @Inject(
- method = ["render"],
- at = [At("INVOKE", target = "renderChunkDebugInfo", shift = At.Shift.AFTER)],
- )
- fun onWorldRenderLast(
- matrices: MatrixStack,
- tickDelta: Float,
- arg2: Long,
- renderBlockOutline: Boolean,
- camera: Camera,
- gameRenderer: GameRenderer,
- lightmapTextureManager: LightmapTextureManager,
- positionMatrix: Matrix4f,
- ci: CallbackInfo
- ) {
- val event = WorldRenderLastEvent(
- matrices, tickDelta, renderBlockOutline,
- camera, gameRenderer, lightmapTextureManager,
- positionMatrix
- )
- WorldRenderLastEvent.publish(event)
- }
-
-}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt
index c851758..6e88b42 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt
@@ -16,10 +16,10 @@ import moe.nea.notenoughupdates.repo.ItemCache.asItemStack
import moe.nea.notenoughupdates.repo.ItemCache.getIdentifier
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.ItemStack
-import net.minecraft.tag.TagKey
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import java.util.stream.Stream
+import net.minecraft.registry.tag.TagKey
object SBItemEntryDefinition : EntryDefinition<NEUItem> {
override fun equals(o1: NEUItem?, o2: NEUItem?, context: ComparisonContext?): Boolean {
@@ -61,7 +61,7 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> {
return null
}
- override fun getTagsFor(entry: EntryStack<NEUItem>?, value: NEUItem?): Stream<out TagKey<*>> {
+ override fun getTagsFor(entry: EntryStack<NEUItem>?, value: NEUItem?): Stream<out TagKey<*>>? {
return Stream.empty()
}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/util/SBData.kt b/src/main/kotlin/moe/nea/notenoughupdates/util/SBData.kt
index 5aad7fc..6d4af7e 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/util/SBData.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/util/SBData.kt
@@ -1,14 +1,11 @@
package moe.nea.notenoughupdates.util
-import java.time.Instant
import kotlinx.serialization.SerializationException
import kotlinx.serialization.decodeFromString
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import kotlin.time.ExperimentalTime
import kotlin.time.TimeSource
-import net.minecraft.network.message.ArgumentSignatureDataMap
-import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket
import moe.nea.notenoughupdates.NotEnoughUpdates
import moe.nea.notenoughupdates.events.ServerChatLineReceivedEvent
import moe.nea.notenoughupdates.events.SkyblockServerUpdateEvent
@@ -62,17 +59,7 @@ object SBData {
fun sendLocraw() {
lastLocrawSent = TimeSource.Monotonic.markNow()
val nh = MC.player?.networkHandler ?: return
- val ack = nh.consumeAcknowledgment()
- nh.sendPacket(
- CommandExecutionC2SPacket(
- "locraw",
- Instant.now(),
- 0L,
- ArgumentSignatureDataMap.EMPTY,
- false,
- ack
- )
- )
+nh.sendChatCommand("locraw")
}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt b/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt
index 9b5432a..9a02996 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/util/render/block.kt
@@ -22,7 +22,7 @@ class RenderBlockContext(val tesselator: Tessellator, val camPos: Vec3d) {
matrixStack.push()
matrixStack.translate(blockPos.x - camPos.x, blockPos.y - camPos.y, blockPos.z - camPos.z)
RenderSystem.applyModelViewMatrix()
- RenderSystem.setShader(GameRenderer::getPositionColorShader)
+ RenderSystem.setShader(GameRenderer::getPositionColorProgram)
buildCube(buffer)
tesselator.draw()
matrixStack.pop()
@@ -73,7 +73,6 @@ class RenderBlockContext(val tesselator: Tessellator, val camPos: Vec3d) {
fun renderBlocks(camera: Camera, block: RenderBlockContext. () -> Unit) {
RenderSystem.disableDepthTest()
- RenderSystem.disableTexture()
RenderSystem.enableBlend()
RenderSystem.defaultBlendFunc()
@@ -82,7 +81,6 @@ class RenderBlockContext(val tesselator: Tessellator, val camPos: Vec3d) {
VertexBuffer.unbind()
RenderSystem.enableDepthTest()
- RenderSystem.enableTexture()
RenderSystem.disableBlend()
}
}