aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/mixins
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/nea/notenoughupdates/mixins
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/nea/notenoughupdates/mixins')
-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
5 files changed, 0 insertions, 129 deletions
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)
- }
-
-}