From ead6762eb1c005914b05f9d3c29f334989c67513 Mon Sep 17 00:00:00 2001 From: nea Date: Tue, 16 May 2023 01:23:43 +0200 Subject: Replace references to NEU with Firmament --- .../java/moe/nea/firmament/init/MixinPlugin.java | 46 +++++++++++++++++++++ .../firmament/mixins/MixinClientPacketHandler.java | 23 +++++++++++ .../mixins/MixinDownloadingTerrainScreen.java | 16 ++++++++ .../nea/firmament/mixins/MixinMessageHandler.java | 34 ++++++++++++++++ .../moe/nea/firmament/mixins/MixinMinecraft.java | 26 ++++++++++++ .../nea/firmament/mixins/MixinWorldRenderer.java | 26 ++++++++++++ .../mixins/accessor/AccessorHandledScreen.java | 14 +++++++ .../mixins/devenv/DisableCommonPacketWarnings.java | 37 +++++++++++++++++ .../mixins/devenv/DisableInvalidFishingHook.java | 15 +++++++ .../firmament/mixins/devenv/MixinScoreboard.java | 15 +++++++ .../moe/nea/notenoughupdates/init/MixinPlugin.java | 47 ---------------------- .../mixins/MixinClientPacketHandler.java | 23 ----------- .../mixins/MixinDownloadingTerrainScreen.java | 16 -------- .../mixins/MixinMessageHandler.java | 34 ---------------- .../notenoughupdates/mixins/MixinMinecraft.java | 26 ------------ .../mixins/MixinWorldRenderer.java | 26 ------------ .../mixins/accessor/AccessorHandledScreen.java | 14 ------- .../mixins/devenv/DisableCommonPacketWarnings.java | 37 ----------------- .../mixins/devenv/DisableInvalidFishingHook.java | 15 ------- .../mixins/devenv/MixinScoreboard.java | 16 -------- 20 files changed, 252 insertions(+), 254 deletions(-) create mode 100644 src/main/java/moe/nea/firmament/init/MixinPlugin.java create mode 100644 src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java create mode 100644 src/main/java/moe/nea/firmament/mixins/MixinDownloadingTerrainScreen.java create mode 100644 src/main/java/moe/nea/firmament/mixins/MixinMessageHandler.java create mode 100644 src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java create mode 100644 src/main/java/moe/nea/firmament/mixins/MixinWorldRenderer.java create mode 100644 src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java create mode 100644 src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java create mode 100644 src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java create mode 100644 src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/MixinDownloadingTerrainScreen.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/MixinMessageHandler.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/MixinMinecraft.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/accessor/AccessorHandledScreen.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableCommonPacketWarnings.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableInvalidFishingHook.java delete mode 100644 src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java (limited to 'src/main/java') diff --git a/src/main/java/moe/nea/firmament/init/MixinPlugin.java b/src/main/java/moe/nea/firmament/init/MixinPlugin.java new file mode 100644 index 0000000..ddb17f4 --- /dev/null +++ b/src/main/java/moe/nea/firmament/init/MixinPlugin.java @@ -0,0 +1,46 @@ +package moe.nea.firmament.init; + +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +public class MixinPlugin implements IMixinConfigPlugin { + @Override + public void onLoad(String mixinPackage) { + + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return Boolean.getBoolean("firmament.debug") || + !mixinClassName.startsWith("moe.nea.firmament.mixins.devenv"); + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + + } + + @Override + public List getMixins() { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + + } + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java new file mode 100644 index 0000000..01ef98e --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinClientPacketHandler.java @@ -0,0 +1,23 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.ParticleSpawnEvent; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.packet.s2c.play.ParticleS2CPacket; +import net.minecraft.util.math.Vec3d; +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; + +@Mixin(ClientPlayNetworkHandler.class) +public class MixinClientPacketHandler { + @Inject(method = "onParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER)) + public void onParticleSpawn(ParticleS2CPacket packet, CallbackInfo ci) { + ParticleSpawnEvent.Companion.publish(new ParticleSpawnEvent( + packet.getParameters(), + new Vec3d(packet.getX(), packet.getY(), packet.getZ()), + new Vec3d(packet.getOffsetX(), packet.getOffsetY(), packet.getOffsetZ()), + packet.isLongDistance() + )); + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/MixinDownloadingTerrainScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinDownloadingTerrainScreen.java new file mode 100644 index 0000000..a1c4ff3 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinDownloadingTerrainScreen.java @@ -0,0 +1,16 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.WorldReadyEvent; +import net.minecraft.client.gui.screen.DownloadingTerrainScreen; +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; + +@Mixin(DownloadingTerrainScreen.class) +public class MixinDownloadingTerrainScreen { + @Inject(method = "close", at = @At("HEAD")) + public void onClose(CallbackInfo ci) { + WorldReadyEvent.Companion.publish(new WorldReadyEvent()); + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/MixinMessageHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinMessageHandler.java new file mode 100644 index 0000000..34dd5a1 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinMessageHandler.java @@ -0,0 +1,34 @@ +package moe.nea.firmament.mixins; + +import com.mojang.authlib.GameProfile; +import moe.nea.firmament.events.ServerChatLineReceivedEvent; +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 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; + +@Mixin(MessageHandler.class) +public class MixinMessageHandler { + @Inject(method = "onChatMessage", cancellable = true, at = @At("HEAD")) + public void onOnChatMessage(SignedMessage message, GameProfile sender, MessageType.Parameters params, CallbackInfo ci) { + var decoratedText = params.applyChatDecoration(message.unsignedContent() != null ? message.unsignedContent() : message.getContent()); + var event = new ServerChatLineReceivedEvent(decoratedText); + if (ServerChatLineReceivedEvent.Companion.publish(event).getCancelled()) { + ci.cancel(); + } + } + + @Inject(method = "onGameMessage", at = @At("HEAD"), cancellable = true) + public void onOnGameMessage(Text message, boolean overlay, CallbackInfo ci) { + if (!overlay) { + var event = new ServerChatLineReceivedEvent(message); + if (ServerChatLineReceivedEvent.Companion.publish(event).getCancelled()) { + ci.cancel(); + } + } + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java b/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java new file mode 100644 index 0000000..f2313d7 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinMinecraft.java @@ -0,0 +1,26 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.ScreenOpenEvent; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftClient.class) +public abstract class MixinMinecraft { + @Shadow + @Nullable + public Screen currentScreen; + + @Inject(method = "setScreen", at = @At("HEAD"), cancellable = true) + public void onScreenChange(Screen screen, CallbackInfo ci) { + var event = new ScreenOpenEvent(currentScreen, screen); + if (ScreenOpenEvent.Companion.publish(event).getCancelled()) { + ci.cancel(); + } + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/MixinWorldRenderer.java b/src/main/java/moe/nea/firmament/mixins/MixinWorldRenderer.java new file mode 100644 index 0000000..e149168 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/MixinWorldRenderer.java @@ -0,0 +1,26 @@ +package moe.nea.firmament.mixins; + +import moe.nea.firmament.events.WorldRenderLastEvent; +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 org.joml.Matrix4f; +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; + +@Mixin(WorldRenderer.class) +public class MixinWorldRenderer { + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER)) + public void onWorldRenderLast(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) { + var event = new WorldRenderLastEvent( + matrices, tickDelta, renderBlockOutline, + camera, gameRenderer, lightmapTextureManager, + positionMatrix + ); + WorldRenderLastEvent.Companion.publish(event); + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java new file mode 100644 index 0000000..1a575c6 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java @@ -0,0 +1,14 @@ +package moe.nea.firmament.mixins.accessor; + +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.screen.slot.Slot; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(HandledScreen.class) +public interface AccessorHandledScreen { + @Accessor("focusedSlot") + @Nullable + Slot getFocusedSlot_NEU(); +} diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java new file mode 100644 index 0000000..16ca7c1 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java @@ -0,0 +1,37 @@ +package moe.nea.firmament.mixins.devenv; + +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.util.Identifier; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.Objects; + +@Mixin(ClientPlayNetworkHandler.class) +public class DisableCommonPacketWarnings { + + @Redirect(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) + public void onCustomPacket(Logger instance, String s, Object o) { + if (!Objects.equals(o, Identifier.of("badlion", "mods"))) { + instance.warn(s, o); + } + } + + @Redirect(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V")) + public void onUnknownPassenger(Logger instance, String s) { + // Ignore passenger data for unknown entities, since HyPixel just sends a lot of those. + } + + @Redirect(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V")) + public void onOnTeam(Logger instance, String s, Object[] objects) { + // Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data. + } + + @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) + public void onOnPlayerList(Logger instance, String s, Object o) { + // Ignore invalid player info, since HyPixel just sends a lot of invalid player info + } + +} diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java new file mode 100644 index 0000000..b1a4049 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java @@ -0,0 +1,15 @@ +package moe.nea.firmament.mixins.devenv; + +import net.minecraft.entity.projectile.FishingBobberEntity; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(FishingBobberEntity.class) +public class DisableInvalidFishingHook { + @Redirect(method = "onSpawnPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V")) + public void onOnSpawnPacket(Logger instance, String s, Object o, Object o1) { + // Don't warn for broken fishing hooks, since HyPixel sends a bunch of those + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java b/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java new file mode 100644 index 0000000..acb0033 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java @@ -0,0 +1,15 @@ +package moe.nea.firmament.mixins.devenv; + +import net.minecraft.scoreboard.Scoreboard; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Scoreboard.class) +public class MixinScoreboard { + @Redirect(method = "addTeam", at=@At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) + public void onExistingteam(Logger instance, String s, Object o) { + // Ignore creations of existing teams + } +} diff --git a/src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java b/src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java deleted file mode 100644 index b2e7e4c..0000000 --- a/src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java +++ /dev/null @@ -1,47 +0,0 @@ -package moe.nea.notenoughupdates.init; - -import moe.nea.notenoughupdates.NotEnoughUpdates; -import org.objectweb.asm.tree.ClassNode; -import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; -import org.spongepowered.asm.mixin.extensibility.IMixinInfo; - -import java.util.List; -import java.util.Set; - -public class MixinPlugin implements IMixinConfigPlugin { - @Override - public void onLoad(String mixinPackage) { - - } - - @Override - public String getRefMapperConfig() { - return null; - } - - @Override - public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - return Boolean.getBoolean("notenoughupdates.debug") || - !mixinClassName.startsWith("moe.nea.notenoughupdates.mixins.devenv"); - } - - @Override - public void acceptTargets(Set myTargets, Set otherTargets) { - - } - - @Override - public List getMixins() { - return null; - } - - @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } - - @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java deleted file mode 100644 index dc57113..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/MixinClientPacketHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package moe.nea.notenoughupdates.mixins; - -import moe.nea.notenoughupdates.events.ParticleSpawnEvent; -import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.network.packet.s2c.play.ParticleS2CPacket; -import net.minecraft.util.math.Vec3d; -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; - -@Mixin(ClientPlayNetworkHandler.class) -public class MixinClientPacketHandler { - @Inject(method = "onParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER)) - public void onParticleSpawn(ParticleS2CPacket packet, CallbackInfo ci) { - ParticleSpawnEvent.Companion.publish(new ParticleSpawnEvent( - packet.getParameters(), - new Vec3d(packet.getX(), packet.getY(), packet.getZ()), - new Vec3d(packet.getOffsetX(), packet.getOffsetY(), packet.getOffsetZ()), - packet.isLongDistance() - )); - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinDownloadingTerrainScreen.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinDownloadingTerrainScreen.java deleted file mode 100644 index 3ed8a73..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/MixinDownloadingTerrainScreen.java +++ /dev/null @@ -1,16 +0,0 @@ -package moe.nea.notenoughupdates.mixins; - -import moe.nea.notenoughupdates.events.WorldReadyEvent; -import net.minecraft.client.gui.screen.DownloadingTerrainScreen; -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; - -@Mixin(DownloadingTerrainScreen.class) -public class MixinDownloadingTerrainScreen { - @Inject(method = "close", at = @At("HEAD")) - public void onClose(CallbackInfo ci) { - WorldReadyEvent.Companion.publish(new WorldReadyEvent()); - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinMessageHandler.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinMessageHandler.java deleted file mode 100644 index 5d3e70f..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/MixinMessageHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -package moe.nea.notenoughupdates.mixins; - -import com.mojang.authlib.GameProfile; -import moe.nea.notenoughupdates.events.ServerChatLineReceivedEvent; -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 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; - -@Mixin(MessageHandler.class) -public class MixinMessageHandler { - @Inject(method = "onChatMessage", cancellable = true, at = @At("HEAD")) - public void onOnChatMessage(SignedMessage message, GameProfile sender, MessageType.Parameters params, CallbackInfo ci) { - var decoratedText = params.applyChatDecoration(message.unsignedContent() != null ? message.unsignedContent() : message.getContent()); - var event = new ServerChatLineReceivedEvent(decoratedText); - if (ServerChatLineReceivedEvent.Companion.publish(event).getCancelled()) { - ci.cancel(); - } - } - - @Inject(method = "onGameMessage", at = @At("HEAD"), cancellable = true) - public void onOnGameMessage(Text message, boolean overlay, CallbackInfo ci) { - if (!overlay) { - var event = new ServerChatLineReceivedEvent(message); - if (ServerChatLineReceivedEvent.Companion.publish(event).getCancelled()) { - ci.cancel(); - } - } - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinMinecraft.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinMinecraft.java deleted file mode 100644 index 17f49e1..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/MixinMinecraft.java +++ /dev/null @@ -1,26 +0,0 @@ -package moe.nea.notenoughupdates.mixins; - -import moe.nea.notenoughupdates.events.ScreenOpenEvent; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftClient.class) -public abstract class MixinMinecraft { - @Shadow - @Nullable - public Screen currentScreen; - - @Inject(method = "setScreen", at = @At("HEAD"), cancellable = true) - public void onScreenChange(Screen screen, CallbackInfo ci) { - var event = new ScreenOpenEvent(currentScreen, screen); - if (ScreenOpenEvent.Companion.publish(event).getCancelled()) { - ci.cancel(); - } - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.java b/src/main/java/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.java deleted file mode 100644 index c3d70fe..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/MixinWorldRenderer.java +++ /dev/null @@ -1,26 +0,0 @@ -package moe.nea.notenoughupdates.mixins; - -import moe.nea.notenoughupdates.events.WorldRenderLastEvent; -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 org.joml.Matrix4f; -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; - -@Mixin(WorldRenderer.class) -public class MixinWorldRenderer { - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER)) - public void onWorldRenderLast(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) { - var event = new WorldRenderLastEvent( - matrices, tickDelta, renderBlockOutline, - camera, gameRenderer, lightmapTextureManager, - positionMatrix - ); - WorldRenderLastEvent.Companion.publish(event); - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/accessor/AccessorHandledScreen.java b/src/main/java/moe/nea/notenoughupdates/mixins/accessor/AccessorHandledScreen.java deleted file mode 100644 index cea44cf..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/accessor/AccessorHandledScreen.java +++ /dev/null @@ -1,14 +0,0 @@ -package moe.nea.notenoughupdates.mixins.accessor; - -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.screen.slot.Slot; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(HandledScreen.class) -public interface AccessorHandledScreen { - @Accessor("focusedSlot") - @Nullable - Slot getFocusedSlot_NEU(); -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableCommonPacketWarnings.java b/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableCommonPacketWarnings.java deleted file mode 100644 index 8302170..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableCommonPacketWarnings.java +++ /dev/null @@ -1,37 +0,0 @@ -package moe.nea.notenoughupdates.mixins.devenv; - -import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.util.Identifier; -import org.slf4j.Logger; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.Objects; - -@Mixin(ClientPlayNetworkHandler.class) -public class DisableCommonPacketWarnings { - - @Redirect(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) - public void onCustomPacket(Logger instance, String s, Object o) { - if (!Objects.equals(o, Identifier.of("badlion", "mods"))) { - instance.warn(s, o); - } - } - - @Redirect(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V")) - public void onUnknownPassenger(Logger instance, String s) { - // Ignore passenger data for unknown entities, since HyPixel just sends a lot of those. - } - - @Redirect(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V")) - public void onOnTeam(Logger instance, String s, Object[] objects) { - // Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data. - } - - @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) - public void onOnPlayerList(Logger instance, String s, Object o) { - // Ignore invalid player info, since HyPixel just sends a lot of invalid player info - } - -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableInvalidFishingHook.java b/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableInvalidFishingHook.java deleted file mode 100644 index 0c434bd..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/DisableInvalidFishingHook.java +++ /dev/null @@ -1,15 +0,0 @@ -package moe.nea.notenoughupdates.mixins.devenv; - -import net.minecraft.entity.projectile.FishingBobberEntity; -import org.slf4j.Logger; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(FishingBobberEntity.class) -public class DisableInvalidFishingHook { - @Redirect(method = "onSpawnPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V")) - public void onOnSpawnPacket(Logger instance, String s, Object o, Object o1) { - // Don't warn for broken fishing hooks, since HyPixel sends a bunch of those - } -} diff --git a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java b/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java deleted file mode 100644 index 306b900..0000000 --- a/src/main/java/moe/nea/notenoughupdates/mixins/devenv/MixinScoreboard.java +++ /dev/null @@ -1,16 +0,0 @@ -package moe.nea.notenoughupdates.mixins.devenv; - -import net.minecraft.scoreboard.Scoreboard; -import org.slf4j.Logger; -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.Redirect; - -@Mixin(Scoreboard.class) -public class MixinScoreboard { - @Redirect(method = "addTeam", at=@At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V")) - public void onExistingteam(Logger instance, String s, Object o) { - // Ignore creations of existing teams - } -} -- cgit