Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1aa45c5
chore: Rename methods and fields
RappyTV Oct 6, 2025
0efacd7
chore: Improve project structure
RappyTV Oct 7, 2025
a381131
feat: Add 1.16.5 support
RappyTV Oct 7, 2025
1feea2a
feat: Add 1.17.1 implementation
RappyTV Oct 7, 2025
3d77143
chore: Improve readme
RappyTV Oct 7, 2025
72b121d
chore: Format CustomRenderTypes classes
RappyTV Oct 8, 2025
2298dc9
feat: Add access widener to access RenderType#create in 1.17.1
RappyTV Oct 8, 2025
bcfccfe
fix: Fix ItemEffect#GLOW crashing on 1.17.1
RappyTV Oct 8, 2025
64dfa46
feat: Add 1.18.2 implementation
RappyTV Oct 8, 2025
79f3db8
feat: Add 1.19.2 implementation
RappyTV Oct 8, 2025
d92906e
feat: Add 1.19.3 implementation
RappyTV Oct 8, 2025
259cb72
feat: Add 1.19.4 implementation
RappyTV Oct 8, 2025
78473ac
feat: Add 1.20.1 implementation
RappyTV Oct 8, 2025
95fe287
feat: Add 1.20.2 implementation
RappyTV Oct 8, 2025
b9b020a
feat: Add 1.20.4 implementation
RappyTV Oct 8, 2025
536df93
feat: Add 1.20.5 implementation
RappyTV Oct 8, 2025
c646547
feat: Add 1.20.6 implementation
RappyTV Oct 8, 2025
9371334
chore: Format ColoredVertexConsumer classes
RappyTV Oct 8, 2025
e1718b8
feat: Add 1.21 implementation
RappyTV Oct 8, 2025
4ea1a5f
feat: Add 1.21.1 implementation
RappyTV Oct 8, 2025
b556c27
feat: Add 1.21.3 implementation
RappyTV Oct 8, 2025
f90d7a6
chore: Register 1.21.5-1.21.10
RappyTV Oct 8, 2025
81ba435
feat: Add 1.21.4 implementation
RappyTV Oct 8, 2025
5f15b63
fix: Fix custom armor glint color not working in 1.20.x
RappyTV Oct 10, 2025
e393fdb
chore: Add missing NotNull annotations in ColoredVertexConsumer
RappyTV Oct 10, 2025
8c34ee6
chore: Prepare pre release
RappyTV Oct 10, 2025
e8a40c3
Merge pull request #2 from RappyLabyAddons/feat/more-version-support
RappyTV Nov 9, 2025
1e7211b
chore: Bump version
RappyTV Nov 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.rappytv.glintcolorizer.api;

public enum ItemEffect {
NONE,
DEFAULT,
GLOW
}
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")

group = "org.example"
version = providers.environmentVariable("VERSION").getOrElse("1.0.0")
version = providers.environmentVariable("VERSION").getOrElse("1.0.1")

labyMod {
defaultPackageName = "com.rappytv.glintcolorizer"
Expand All @@ -16,12 +16,15 @@ labyMod {
displayName = "GlintColorizer"
author = "RappyTV"
description = "Lets you adjust the color of enchanted items and armor."
minecraftVersion = "1.8.9,1.12.2"
minecraftVersion = "1.8.9<1.21.4"
version = rootProject.version.toString()
}

minecraft {
registerVersion(versions.toTypedArray()) {

accessWidener.set(file("./game-runner/src/${this.sourceSetName}/resources/glintcolorizer-${versionId}.accesswidener"))

runs {
getByName("client") {
devLogin = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.rappytv.glintcolorizer;
package com.rappytv.glintcolorizer.core;

import com.rappytv.glintcolorizer.GlintColorizerConfig.ItemEffect;
import com.rappytv.glintcolorizer.api.ItemEffect;
import net.labymod.api.addon.LabyAddon;
import net.labymod.api.models.addon.annotation.AddonMain;
import net.labymod.api.util.Color;
Expand All @@ -9,11 +9,11 @@
@AddonMain
public class GlintColorizerAddon extends LabyAddon<GlintColorizerConfig> {

private static GlintColorizerAddon instance;
private static GlintColorizerAddon INSTANCE;

@Override
protected void enable() {
instance = this;
INSTANCE = this;

this.registerSettingCategory();
}
Expand All @@ -24,26 +24,26 @@ protected Class<? extends GlintColorizerConfig> configurationClass() {
}

public static ItemEffect getItemEffect() {
return instance.configuration().enabled().get()
? instance.configuration().itemEffect().get()
return INSTANCE.configuration().enabled().get()
? INSTANCE.configuration().itemEffect().get()
: ItemEffect.DEFAULT;
}

@Nullable
public static Color getItemGlintColor() {
if(!instance.configuration().enabled().get()
|| !instance.configuration().enableCustomItemGlintColor().get()) {
if (!INSTANCE.configuration().enabled().get()
|| !INSTANCE.configuration().enableCustomItemGlintColor().get()) {
return null;
}
return instance.configuration().customItemGlintColor().get();
return INSTANCE.configuration().customItemGlintColor().get();
}

@Nullable
public static Color getArmorGlintColor() {
if(!instance.configuration().enabled().get()
|| !instance.configuration().enableCustomArmorGlintColor().get()) {
if (!INSTANCE.configuration().enabled().get()
|| !INSTANCE.configuration().enableCustomArmorGlintColor().get()) {
return null;
}
return instance.configuration().customArmorGlintColor().get();
return INSTANCE.configuration().customArmorGlintColor().get();
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.rappytv.glintcolorizer;
package com.rappytv.glintcolorizer.core;

import com.rappytv.glintcolorizer.api.ItemEffect;
import net.labymod.api.addon.AddonConfig;
import net.labymod.api.client.component.format.NamedTextColor;
import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting;
import net.labymod.api.client.gui.screen.widget.widgets.input.color.ColorPickerWidget.ColorPickerSetting;
import net.labymod.api.client.gui.screen.widget.widgets.input.dropdown.DropdownWidget.DropdownSetting;
import net.labymod.api.configuration.loader.annotation.SpriteSlot;
import net.labymod.api.configuration.loader.annotation.SpriteTexture;
import net.labymod.api.configuration.loader.annotation.VersionCompatibility;
import net.labymod.api.configuration.loader.property.ConfigProperty;
import net.labymod.api.configuration.settings.annotation.SettingRequires;
import net.labymod.api.configuration.settings.annotation.SettingSection;
import net.labymod.api.util.Color;

@SpriteTexture("settings.png")
@SpriteTexture("settings")
public class GlintColorizerConfig extends AddonConfig {

@SpriteSlot
Expand All @@ -23,19 +25,24 @@ public class GlintColorizerConfig extends AddonConfig {
@SpriteSlot(x = 1)
@DropdownSetting
private final ConfigProperty<ItemEffect> itemEffect = new ConfigProperty<>(ItemEffect.DEFAULT);

@SpriteSlot(size = 32, x = 2)
@SwitchSetting
private final ConfigProperty<Boolean> enableCustomItemGlintColor = new ConfigProperty<>(true);

@SettingRequires("enableCustomItemGlintColor")
@SpriteSlot(size = 32, x = 3)
@ColorPickerSetting(chroma = true)
private final ConfigProperty<Color> customItemGlintColor = new ConfigProperty<>(Color.WHITE);

@SettingSection("armor")
@VersionCompatibility("1.8<1.20.6")
@SpriteSlot(x = 2)
@SwitchSetting
private final ConfigProperty<Boolean> enableCustomArmorGlintColor = new ConfigProperty<>(true);

@SettingRequires("enableCustomArmorGlintColor")
@VersionCompatibility("1.8<1.20.6")
@SpriteSlot(size = 32, x = 3)
@ColorPickerSetting(chroma = true)
private final ConfigProperty<Color> customArmorGlintColor = new ConfigProperty<>(NamedTextColor.AQUA.color());
Expand All @@ -48,23 +55,20 @@ public ConfigProperty<Boolean> enabled() {
public ConfigProperty<ItemEffect> itemEffect() {
return this.itemEffect;
}

public ConfigProperty<Boolean> enableCustomItemGlintColor() {
return this.enableCustomItemGlintColor;
}

public ConfigProperty<Color> customItemGlintColor() {
return this.customItemGlintColor;
}

public ConfigProperty<Boolean> enableCustomArmorGlintColor() {
return this.enableCustomArmorGlintColor;
}

public ConfigProperty<Color> customArmorGlintColor() {
return this.customArmorGlintColor;
}

public enum ItemEffect {
NONE,
DEFAULT,
GLOW
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.rappytv.glintcolorizer.v1_12_2.mixins;

import com.rappytv.glintcolorizer.GlintColorizerAddon;
import com.rappytv.glintcolorizer.core.GlintColorizerAddon;
import net.labymod.api.util.Color;
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.rappytv.glintcolorizer.v1_12_2.mixins;

import com.rappytv.glintcolorizer.GlintColorizerAddon;
import com.rappytv.glintcolorizer.GlintColorizerConfig.ItemEffect;
import com.rappytv.glintcolorizer.api.ItemEffect;
import com.rappytv.glintcolorizer.core.GlintColorizerAddon;
import net.labymod.api.util.Color;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;
Expand All @@ -20,25 +20,25 @@
public class MixinRenderItem {

@Unique
private boolean sandbox$firstDepthCall = true;
private boolean glintcolorizer$firstDepthCall = true;

@Inject(method = "renderEffect", at = @At("HEAD"), cancellable = true)
private void renderEffect(IBakedModel model, CallbackInfo ci) {
private void cancelGlintRendering(IBakedModel model, CallbackInfo ci) {
if(GlintColorizerAddon.getItemEffect() == ItemEffect.NONE) {
ci.cancel();
}
}

@Redirect(method = "renderEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;depthFunc(I)V"))
private void modifyDepthFunc(int i) {
if(this.sandbox$firstDepthCall) {
if(this.glintcolorizer$firstDepthCall) {
if(GlintColorizerAddon.getItemEffect() != ItemEffect.GLOW) {
GlStateManager.depthFunc(GL11.GL_EQUAL);
}
} else {
GlStateManager.depthFunc(i);
}
this.sandbox$firstDepthCall = !this.sandbox$firstDepthCall;
this.glintcolorizer$firstDepthCall = !this.glintcolorizer$firstDepthCall;
}

@ModifyConstant(method = "renderEffect", constant = @Constant(intValue = -8372020))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.rappytv.glintcolorizer.v1_16_5;

import com.mojang.blaze3d.vertex.VertexConsumer;
import net.labymod.api.util.Color;

public class ColoredVertexConsumer implements VertexConsumer {

private final VertexConsumer delegate;
private final float red;
private final float green;
private final float blue;

public ColoredVertexConsumer(VertexConsumer delegate, Color color) {
this.delegate = delegate;
this.red = color.getRed() / 255f;
this.green = color.getGreen() / 255f;
this.blue = color.getBlue() / 255f;
}

@Override
public VertexConsumer vertex(double x, double y, double z) {
return this.delegate.vertex(x, y, z);
}

@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
return this.delegate.color(
(int) (red * this.red),
(int) (green * this.green),
(int) (blue * this.blue),
alpha
);
}

@Override
public VertexConsumer uv(float u, float v) {
return this.delegate.uv(u, v);
}

@Override
public VertexConsumer overlayCoords(int u, int v) {
return this.delegate.overlayCoords(u, v);
}

@Override
public VertexConsumer uv2(int u, int v) {
return this.delegate.uv2(u, v);
}

@Override
public VertexConsumer normal(float x, float y, float z) {
return this.delegate.normal(x, y, z);
}

@Override
public void endVertex() {
this.delegate.endVertex();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package com.rappytv.glintcolorizer.v1_16_5;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.ItemRenderer;

public class CustomRenderTypes extends RenderType {

private static final RenderType GLOW_GLINT = create(
"glint_glow",
DefaultVertexFormat.POSITION_TEX,
7,
256,
RenderType.CompositeState.builder()
.setTextureState(new RenderStateShard.TextureStateShard(
ItemRenderer.ENCHANT_GLINT_LOCATION,
true,
false
))
.setWriteMaskState(COLOR_WRITE)
.setCullState(NO_CULL)
.setDepthTestState(NO_DEPTH_TEST)
.setTransparencyState(GLINT_TRANSPARENCY)
.setTexturingState(GLINT_TEXTURING)
.createCompositeState(false)
);

private static final RenderType GLOW_ENTITY_GLINT = create(
"entity_glint_glow",
DefaultVertexFormat.POSITION_TEX,
7,
256,
RenderType.CompositeState.builder()
.setTextureState(new RenderStateShard.TextureStateShard(
ItemRenderer.ENCHANT_GLINT_LOCATION,
true,
false
))
.setWriteMaskState(COLOR_WRITE)
.setCullState(NO_CULL)
.setDepthTestState(NO_DEPTH_TEST)
.setTransparencyState(GLINT_TRANSPARENCY)
.setTexturingState(ENTITY_GLINT_TEXTURING)
.createCompositeState(false)
);

private static final RenderType GLOW_GLINT_DIRECT = create(
"glint_direct_glow",
DefaultVertexFormat.POSITION_TEX,
7,
256,
RenderType.CompositeState.builder()
.setTextureState(new RenderStateShard.TextureStateShard(
ItemRenderer.ENCHANT_GLINT_LOCATION,
true,
false
))
.setWriteMaskState(COLOR_WRITE)
.setCullState(NO_CULL)
.setDepthTestState(NO_DEPTH_TEST)
.setTransparencyState(GLINT_TRANSPARENCY)
.setTexturingState(GLINT_TEXTURING)
.createCompositeState(false)
);

private static final RenderType GLOW_ENTITY_GLINT_DIRECT = create(
"entity_glint_direct_glow",
DefaultVertexFormat.POSITION_TEX,
7,
256,
RenderType.CompositeState.builder()
.setTextureState(new RenderStateShard.TextureStateShard(
ItemRenderer.ENCHANT_GLINT_LOCATION,
true,
false
))
.setWriteMaskState(COLOR_WRITE)
.setCullState(NO_CULL)
.setDepthTestState(NO_DEPTH_TEST)
.setTransparencyState(GLINT_TRANSPARENCY)
.setTexturingState(ENTITY_GLINT_TEXTURING)
.createCompositeState(false)
);

private CustomRenderTypes(
String name,
VertexFormat format,
int mode,
int bufferSize,
boolean affectsCrumbling,
boolean sortOnUpload,
Runnable setupState,
Runnable clearState
) {
super(name, format, mode, bufferSize, affectsCrumbling, sortOnUpload, setupState, clearState);
}

public static RenderType getGlowGlint() {
return GLOW_GLINT;
}

public static RenderType getGlowEntityGlint() {
return GLOW_ENTITY_GLINT;
}

public static RenderType getGlowGlintDirect() {
return GLOW_GLINT_DIRECT;
}

public static RenderType getGlowEntityGlintDirect() {
return GLOW_ENTITY_GLINT_DIRECT;
}
}
Loading