From f67ae915ca944d67759c3c88912f00ab02570e63 Mon Sep 17 00:00:00 2001 From: omergunr100 Date: Sun, 29 Dec 2024 23:01:06 +0200 Subject: [PATCH] the great unjankening (by adding more jank code) --- .../ftbchunks/FTBChunksClientMixin.java | 42 +++++++++++++++++++ .../ftbchunks/veins/fluid/FluidVeinIcon.java | 2 +- src/main/resources/gtceu.mixins.json | 9 ++-- 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/core/mixins/ftbchunks/FTBChunksClientMixin.java diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ftbchunks/FTBChunksClientMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ftbchunks/FTBChunksClientMixin.java new file mode 100644 index 0000000000..46f8f04e62 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ftbchunks/FTBChunksClientMixin.java @@ -0,0 +1,42 @@ +package com.gregtechceu.gtceu.core.mixins.ftbchunks; + +import com.gregtechceu.gtceu.integration.map.ftbchunks.veins.fluid.FluidVeinIcon; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; + +import com.llamalad7.mixinextras.sugar.Local; +import com.mojang.math.Axis; +import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; +import dev.ftb.mods.ftbchunks.client.FTBChunksClient; +import dev.ftb.mods.ftbchunks.client.FTBChunksClientConfig; +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.Slice; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = FTBChunksClient.class) +public class FTBChunksClientMixin { + + @Inject(method = "renderHud", + at = @At(value = "INVOKE", + target = "Lcom/mojang/blaze3d/vertex/PoseStack;scale(FFF)V", + shift = At.Shift.AFTER), + slice = @Slice(from = @At(value = "INVOKE", + target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;getPos(F)Lnet/minecraft/world/phys/Vec3;"), + to = @At(value = "INVOKE", + target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;draw(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;Lnet/minecraft/client/gui/GuiGraphics;IIIIZI)V"))) + private void gtceu$injectRenderHud(GuiGraphics graphics, float tickDelta, CallbackInfo ci, @Local MapIcon icon) { + if (icon instanceof FluidVeinIcon) { + var mc = Minecraft.getInstance(); + var rotationLocked = FTBChunksClientConfig.MINIMAP_LOCKED_NORTH.get() || + FTBChunksClientConfig.SQUARE_MINIMAP.get(); + var poseStack = graphics.pose(); + var minimapRotation = (rotationLocked ? 180F : -mc.player.getYRot()) % 360F; + poseStack.translate(0.5, 0.5, 0); + poseStack.mulPose(Axis.ZP.rotationDegrees(minimapRotation + 180f)); + poseStack.translate(-0.5, -0.5, 0); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/map/ftbchunks/veins/fluid/FluidVeinIcon.java b/src/main/java/com/gregtechceu/gtceu/integration/map/ftbchunks/veins/fluid/FluidVeinIcon.java index 74caf5036b..338e89b2ca 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/map/ftbchunks/veins/fluid/FluidVeinIcon.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/map/ftbchunks/veins/fluid/FluidVeinIcon.java @@ -62,7 +62,7 @@ public int getColor() { @Override public double getIconScale(MapType mapType) { - return mapType.isMinimap() ? FTBChunksClientConfig.MINIMAP_SCALE.get() : size; + return mapType.isMinimap() ? FTBChunksClientConfig.MINIMAP_ZOOM.get() : size; } @Override diff --git a/src/main/resources/gtceu.mixins.json b/src/main/resources/gtceu.mixins.json index c5cbfa1f6a..f3d503ca48 100644 --- a/src/main/resources/gtceu.mixins.json +++ b/src/main/resources/gtceu.mixins.json @@ -15,14 +15,15 @@ "LevelRendererMixin", "ModelManagerMixin", "MultiPlayerGameModeMixin", + "ftbchunks.LargeMapScreenMixin", + "ftbchunks.RegionMapPanelMixin", + "ftbchunks.FTBChunksClientMixin", "journeymap.FullscreenMixin", "rei.FluidEntryRendererMixin", - "ftbchunks.RegionMapPanelMixin", - "ftbchunks.LargeMapScreenMixin", - "xaeroworldmap.GuiMapMixin", - "xaeroworldmap.MapElementRenderHandlerBuilderMixin", "xaerominimap.HighlighterRegistryMixin", "xaerominimap.MinimapFBORendererMixin", + "xaeroworldmap.GuiMapMixin", + "xaeroworldmap.MapElementRenderHandlerBuilderMixin", "xaeroworldmap.WorldMapSessionMixin" ], "mixins": [