Skip to content

Commit

Permalink
Take the wheel imToggle 🥶
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Jun 2, 2024
1 parent 6027c85 commit 13ad58e
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,47 @@ public class RenderItemMixin_GlintCustomizer {
}
}

@ModifyArg(
method = "renderEffect",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GlStateManager;translate(FFF)V"
),
index = 0
)
private float glintColorizer$modifySpeed(float speed) {
if (!GlintConfig.INSTANCE.enabled) { return speed; }
return glintColorizer$getModifiedSpeed(speed); //todo: adw
}

@ModifyArg(
method = "renderEffect",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
ordinal = 0
),
index = 0
)
private float glintColorizer$modifyRotation(float angle) {
if (!GlintConfig.INSTANCE.enabled) { return angle; }
return glintColorizer$getModifiedRotation(angle, true); //todo: adw
}

@ModifyArg(
method = "renderEffect",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
ordinal = 1
),
index = 0
)
private float glintColorizer$modifyRotation2(float angle) {
if (!GlintConfig.INSTANCE.enabled) { return angle; }
return glintColorizer$getModifiedRotation(angle, false); //todo: adw
}

@ModifyArg(
method = "renderEffect",
at = @At(
Expand Down Expand Up @@ -103,6 +144,76 @@ public class RenderItemMixin_GlintCustomizer {
return color;
}

@Unique
private float glintColorizer$getModifiedRotation(float color, boolean isFirstStroke) {
if (RenderItemHook.INSTANCE.isRenderingHeld()) {
return isFirstStroke ? GlintConfig.INSTANCE.getHeldStrokeRotOne() : GlintConfig.INSTANCE.getHeldStrokeRotTwo();
}

// if (RenderItemHook.INSTANCE.isRenderingInGUI()) {
// if (GlintConfig.INSTANCE.getPotionBasedColor() && RenderItemHook.INSTANCE.isPotionItem()) {
// return glintColorizer$getPotionColor(RenderItemHook.INSTANCE.getItemStack());
// }
// if (GlintConfig.INSTANCE.getPotionGlintBackground() && RenderItemHook.INSTANCE.isPotionItem()) {
// return GlintConfig.INSTANCE.getShinyIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getShinyStrokeOne().getRGB() : GlintConfig.INSTANCE.getShinyStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getShinyColor().getRGB();
// }
// return GlintConfig.INSTANCE.getGuiIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getGuiStrokeOne().getRGB() : GlintConfig.INSTANCE.getGuiStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getGuiColor().getRGB();
// }
//
// if (RenderItemHook.INSTANCE.isRenderingDropped()) {
// return GlintConfig.INSTANCE.getDroppedIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getDroppedStrokeOne().getRGB() : GlintConfig.INSTANCE.getDroppedStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getDroppedColor().getRGB();
// }
//
// if (RenderItemHook.INSTANCE.isRenderingFramed()) {
// return GlintConfig.INSTANCE.getFramedIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getFramedStrokeOne().getRGB() : GlintConfig.INSTANCE.getFramedStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getFramedColor().getRGB();
// }

return color;
}

@Unique
private float glintColorizer$getModifiedSpeed(float speed) {
if (RenderItemHook.INSTANCE.isRenderingHeld()) {
return GlintConfig.INSTANCE.getHeldSpeed() * speed;
}

// if (RenderItemHook.INSTANCE.isRenderingInGUI()) {
// if (GlintConfig.INSTANCE.getPotionBasedColor() && RenderItemHook.INSTANCE.isPotionItem()) {
// return glintColorizer$getPotionColor(RenderItemHook.INSTANCE.getItemStack());
// }
// if (GlintConfig.INSTANCE.getPotionGlintBackground() && RenderItemHook.INSTANCE.isPotionItem()) {
// return GlintConfig.INSTANCE.getShinyIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getShinyStrokeOne().getRGB() : GlintConfig.INSTANCE.getShinyStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getShinyColor().getRGB();
// }
// return GlintConfig.INSTANCE.getGuiIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getGuiStrokeOne().getRGB() : GlintConfig.INSTANCE.getGuiStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getGuiColor().getRGB();
// }
//
// if (RenderItemHook.INSTANCE.isRenderingDropped()) {
// return GlintConfig.INSTANCE.getDroppedIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getDroppedStrokeOne().getRGB() : GlintConfig.INSTANCE.getDroppedStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getDroppedColor().getRGB();
// }
//
// if (RenderItemHook.INSTANCE.isRenderingFramed()) {
// return GlintConfig.INSTANCE.getFramedIndividualStrokes() ?
// (isFirstStroke ? GlintConfig.INSTANCE.getFramedStrokeOne().getRGB() : GlintConfig.INSTANCE.getFramedStrokeTwo().getRGB()) :
// GlintConfig.INSTANCE.getFramedColor().getRGB();
// }

return speed;
}

@Unique
private boolean glintColorizer$shouldApplyMatrix() {
return GlintConfig.INSTANCE.getPotionGlintSize() &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.polyfrost.glintcolorizer

import cc.polyfrost.oneconfig.config.core.ConfigUtils
import cc.polyfrost.oneconfig.utils.commands.CommandManager
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.event.FMLInitializationEvent
Expand All @@ -20,8 +19,6 @@ object GlintColorizer {
const val VER: String = "@VER@"
const val ID: String = "@ID@"

val path = "${ConfigUtils.getProfileDir().absolutePath}/${ID}/caches/"

@Mod.EventHandler
fun onInit(event: FMLInitializationEvent?) {
GlintConfig
Expand Down
Loading

0 comments on commit 13ad58e

Please sign in to comment.