Skip to content

Commit

Permalink
the great unjankening (by adding more jank code)
Browse files Browse the repository at this point in the history
  • Loading branch information
omergunr100 committed Dec 29, 2024
1 parent fd45b70 commit f67ae91
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/gtceu.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down

0 comments on commit f67ae91

Please sign in to comment.