refactor: match mixin classes with mojmaps namings
This commit is contained in:
+2
-2
@@ -11,9 +11,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(KeyboardHandler.class)
|
@Mixin(KeyboardHandler.class)
|
||||||
public class MixinKeyboard {
|
public class MixinKeyboardHandler {
|
||||||
@Inject(method = "keyPress", at = @At("TAIL"), cancellable = true)
|
@Inject(method = "keyPress", at = @At("TAIL"), cancellable = true)
|
||||||
private void onKey(long window, int action, KeyEvent input, CallbackInfo ci) {
|
private void keyPress(long window, int action, KeyEvent input, CallbackInfo ci) {
|
||||||
if (action != 1) {
|
if (action != 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -11,9 +11,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(MouseHandler.class)
|
@Mixin(MouseHandler.class)
|
||||||
public class MixinMouse {
|
public class MixinMouseHandler {
|
||||||
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onButton", at = @At("HEAD"), cancellable = true)
|
||||||
private void onMouseButton(long window, MouseButtonInfo input, int action, CallbackInfo ci) {
|
private void onButton(long window, MouseButtonInfo input, int action, CallbackInfo ci) {
|
||||||
if (EVENT_BUS.post(new MouseInputEvent(input.button(), action))) {
|
if (EVENT_BUS.post(new MouseInputEvent(input.button(), action))) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
+2
-2
@@ -10,9 +10,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(ClientPacketListener.class)
|
@Mixin(ClientPacketListener.class)
|
||||||
public class MixinClientPlayNetworkHandler {
|
public class MixinClientPacketListener {
|
||||||
@Inject(method = "sendChat", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "sendChat", at = @At("HEAD"), cancellable = true)
|
||||||
private void sendChatMessageHook(String content, CallbackInfo ci) {
|
private void sendChat(String content, CallbackInfo ci) {
|
||||||
if (EVENT_BUS.post(new ChatEvent(content))) {
|
if (EVENT_BUS.post(new ChatEvent(content))) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
+2
-2
@@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(Connection.class)
|
@Mixin(Connection.class)
|
||||||
public class MixinClientConnection {
|
public class MixinConnection {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private Channel channel;
|
private Channel channel;
|
||||||
@@ -38,7 +38,7 @@ public class MixinClientConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
|
||||||
private void sendImmediately(Packet<?> packet, ChannelFutureListener callbacks, boolean flush, CallbackInfo ci) {
|
private void sendPacket(Packet<?> packet, ChannelFutureListener callbacks, boolean flush, CallbackInfo ci) {
|
||||||
if (this.receiving != PacketFlow.CLIENTBOUND) return;
|
if (this.receiving != PacketFlow.CLIENTBOUND) return;
|
||||||
try {
|
try {
|
||||||
if (EVENT_BUS.post(new PacketEvent.Send(packet))) {
|
if (EVENT_BUS.post(new PacketEvent.Send(packet))) {
|
||||||
@@ -5,6 +5,7 @@ import net.minecraft.client.GuiMessage;
|
|||||||
import net.minecraft.client.gui.components.ChatComponent;
|
import net.minecraft.client.gui.components.ChatComponent;
|
||||||
import net.minecraft.network.chat.MessageSignature;
|
import net.minecraft.network.chat.MessageSignature;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mixin(ChatComponent.class)
|
@Mixin(ChatComponent.class)
|
||||||
public abstract class MixinChatComponent implements IChatComponent {
|
public abstract class MixinChatComponent implements IChatComponent {
|
||||||
@Shadow
|
@Final @Shadow
|
||||||
private List<GuiMessage> allMessages;
|
private List<GuiMessage> allMessages;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
|
|||||||
+4
-3
@@ -2,6 +2,7 @@ package me.alpha432.oyvey.mixin.render;
|
|||||||
|
|
||||||
import me.alpha432.oyvey.OyVey;
|
import me.alpha432.oyvey.OyVey;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -9,12 +10,12 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(DeltaTracker.Timer.class)
|
@Mixin(DeltaTracker.Timer.class)
|
||||||
public class MixinRenderTickCounter {
|
public class MixinDeltaTrackerTimer {
|
||||||
@Shadow
|
@Shadow
|
||||||
private float deltaTicks;
|
private float deltaTicks;
|
||||||
|
|
||||||
@Inject(method = "advanceGameTime(J)I", at = @At(value = "FIELD", target = "Lnet/minecraft/client/DeltaTracker$Timer;lastMs:J"))
|
@Inject(method = "advanceGameTime(J)I", at = @At(value = "FIELD", target = "Lnet/minecraft/client/DeltaTracker$Timer;lastMs:J", opcode = Opcodes.PUTFIELD))
|
||||||
public void beginRenderTick(long timeMillis, CallbackInfoReturnable<Integer> cir) {
|
public void advanceGameTime(long timeMillis, CallbackInfoReturnable<Integer> cir) {
|
||||||
this.deltaTicks *= OyVey.TIMER;
|
this.deltaTicks *= OyVey.TIMER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,27 @@
|
|||||||
package me.alpha432.oyvey.mixin.render;
|
package me.alpha432.oyvey.mixin.render;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
|
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.math.Axis;
|
||||||
|
import me.alpha432.oyvey.event.impl.render.Render3DEvent;
|
||||||
import me.alpha432.oyvey.event.impl.render.RenderBlockOutlineEvent;
|
import me.alpha432.oyvey.event.impl.render.RenderBlockOutlineEvent;
|
||||||
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.client.DeltaTracker;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.state.LevelRenderState;
|
import net.minecraft.client.renderer.state.LevelRenderState;
|
||||||
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector4f;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
import static me.alpha432.oyvey.util.traits.Util.mc;
|
||||||
|
|
||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public class MixinLevelRenderer {
|
public class MixinLevelRenderer {
|
||||||
@@ -20,4 +31,23 @@ public class MixinLevelRenderer {
|
|||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderLevel", at = @At("RETURN"))
|
||||||
|
private void render(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderBlockOutline,
|
||||||
|
Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix,
|
||||||
|
GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci, @Local ProfilerFiller profiler) {
|
||||||
|
|
||||||
|
PoseStack stack = new PoseStack();
|
||||||
|
stack.pushPose();
|
||||||
|
stack.mulPose(Axis.XP.rotationDegrees(mc.gameRenderer.getMainCamera().xRot()));
|
||||||
|
stack.mulPose(Axis.YP.rotationDegrees(mc.gameRenderer.getMainCamera().yRot() + 180f));
|
||||||
|
|
||||||
|
profiler.push("oyvey-render-3d");
|
||||||
|
|
||||||
|
Render3DEvent event = new Render3DEvent(stack, tickCounter.getGameTimeDeltaPartialTick(true));
|
||||||
|
EVENT_BUS.post(event);
|
||||||
|
stack.popPose();
|
||||||
|
profiler.pop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
package me.alpha432.oyvey.mixin.render;
|
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
|
||||||
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
import com.mojang.math.Axis;
|
|
||||||
import me.alpha432.oyvey.event.impl.render.Render3DEvent;
|
|
||||||
import net.minecraft.client.Camera;
|
|
||||||
import net.minecraft.client.DeltaTracker;
|
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Vector4f;
|
|
||||||
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 static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
|
||||||
import static me.alpha432.oyvey.util.traits.Util.mc;
|
|
||||||
|
|
||||||
@Mixin(LevelRenderer.class)
|
|
||||||
public class MixinWorldRenderer {
|
|
||||||
@Inject(method = "renderLevel", at = @At("RETURN"))
|
|
||||||
private void render(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderBlockOutline,
|
|
||||||
Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix,
|
|
||||||
GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci, @Local ProfilerFiller profiler) {
|
|
||||||
|
|
||||||
PoseStack stack = new PoseStack();
|
|
||||||
stack.pushPose();
|
|
||||||
stack.mulPose(Axis.XP.rotationDegrees(mc.gameRenderer.getMainCamera().xRot()));
|
|
||||||
stack.mulPose(Axis.YP.rotationDegrees(mc.gameRenderer.getMainCamera().yRot() + 180f));
|
|
||||||
|
|
||||||
profiler.push("oyvey-render-3d");
|
|
||||||
|
|
||||||
Render3DEvent event = new Render3DEvent(stack, tickCounter.getGameTimeDeltaPartialTick(true));
|
|
||||||
EVENT_BUS.post(event);
|
|
||||||
stack.popPose();
|
|
||||||
profiler.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
import static me.alpha432.oyvey.util.traits.Util.EVENT_BUS;
|
||||||
|
|
||||||
@Mixin(Gui.class)
|
@Mixin(Gui.class)
|
||||||
public class MixinInGameHud {
|
public class MixinGui {
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("RETURN"))
|
@Inject(method = "render", at = @At("RETURN"))
|
||||||
public void render(GuiGraphics context, DeltaTracker tickCounter, CallbackInfo ci) {
|
public void render(GuiGraphics context, DeltaTracker tickCounter, CallbackInfo ci) {
|
||||||
@@ -4,19 +4,18 @@
|
|||||||
"package": "me.alpha432.oyvey.mixin",
|
"package": "me.alpha432.oyvey.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"network.MixinClientConnection"
|
"network.MixinConnection"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"entity.MixinClientPlayerEntity",
|
"entity.MixinClientPlayerEntity",
|
||||||
"input.MixinKeyboard",
|
"input.MixinKeyboardHandler",
|
||||||
"input.MixinMouse",
|
"input.MixinMouseHandler",
|
||||||
"network.MixinClientPlayNetworkHandler",
|
"network.MixinClientPacketListener",
|
||||||
"render.MixinChatComponent",
|
"render.MixinChatComponent",
|
||||||
"render.MixinLevelRenderer",
|
"render.MixinLevelRenderer",
|
||||||
"render.MixinRenderTickCounter",
|
"render.MixinDeltaTrackerTimer",
|
||||||
"render.MixinWorldRenderer",
|
|
||||||
"render.gui.MixinCommandSuggestions",
|
"render.gui.MixinCommandSuggestions",
|
||||||
"render.gui.MixinInGameHud"
|
"render.gui.MixinGui"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user