Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
grey to gray and settingstoint to rgbtoint
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed Mar 21, 2020
1 parent 948a2cd commit ff8323b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import me.zeroeightsix.kami.gui.rgui.render.AbstractComponentUI;
import me.zeroeightsix.kami.gui.rgui.render.font.FontRenderer;

import static me.zeroeightsix.kami.util.ColourConverter.settingsToInt;
import static me.zeroeightsix.kami.util.ColourConverter.rgbToInt;
import static me.zeroeightsix.kami.util.ColourConverter.toF;
import static me.zeroeightsix.kami.util.ColourSet.*;
import static org.lwjgl.opengl.GL11.*;
Expand All @@ -28,11 +28,11 @@ public void renderComponent(CheckButton component, FontRenderer ff) {

String text = component.getName(); // on toggle, toggled, hovered enabled
int c = component.isPressed() ?
settingsToInt(buttonPressed.getRed(), buttonPressed.getGreen(), buttonPressed.getBlue()) : component.isToggled() ?
settingsToInt(buttonIdleT.getRed(), buttonIdleT.getGreen(), buttonIdleT.getBlue()) :
settingsToInt(buttonHoveredT.getRed(), buttonHoveredT.getGreen(), buttonHoveredT.getBlue());
rgbToInt(buttonPressed.getRed(), buttonPressed.getGreen(), buttonPressed.getBlue()) : component.isToggled() ?
rgbToInt(buttonIdleT.getRed(), buttonIdleT.getGreen(), buttonIdleT.getBlue()) :
rgbToInt(buttonHoveredT.getRed(), buttonHoveredT.getGreen(), buttonHoveredT.getBlue());
if (component.isHovered())
c = (c & settingsToInt(buttonHoveredN.getRed(), buttonHoveredN.getGreen(), buttonHoveredN.getBlue())) << 1;
c = (c & rgbToInt(buttonHoveredN.getRed(), buttonHoveredN.getGreen(), buttonHoveredN.getBlue())) << 1;

glColor3f(1, 1, 1);
glEnable(GL_TEXTURE_2D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
@Module.Info(name = "ChatTimestamp", category = Module.Category.CHAT, description = "Shows the time a message was sent beside the message", showOnArray = Module.ShowOnArray.OFF)
public class ChatTimestamp extends Module {
private Setting<ColourUtils.ColourCode> firstColour = register(Settings.e("First Colour", ColourUtils.ColourCode.GREY));
private Setting<ColourUtils.ColourCode> firstColour = register(Settings.e("First Colour", ColourUtils.ColourCode.GRAY));
private Setting<ColourUtils.ColourCode> secondColour = register(Settings.e("Second Colour", ColourUtils.ColourCode.WHITE));
private Setting<TimeUtil.TimeType> timeTypeSetting = register(Settings.e("Time Format", TimeUtil.TimeType.HHMM));
private Setting<TimeUtil.TimeUnit> timeUnitSetting = register(Settings.e("Time Unit", TimeUtil.TimeUnit.H12));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.ColourConverter;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
Expand All @@ -17,7 +18,8 @@

import java.util.List;

import static me.zeroeightsix.kami.util.ColourConverter.settingsToInt;
import static me.zeroeightsix.kami.command.Command.sendDisableMessage;
import static me.zeroeightsix.kami.util.ColourConverter.rgbToInt;

/**
* Updated by S-B99 on 21/02/20
Expand Down Expand Up @@ -109,7 +111,7 @@ private void boxRender(final int x, final int y) {
GlStateManager.disableDepth();
// }
if (coloredBackground.getValue()) { // 1 == 2 px in game
Gui.drawRect(x, y, x + 162, y + 54, settingsToInt(r.getValue(), g.getValue(), b.getValue(), a.getValue()));
Gui.drawRect(x, y, x + 162, y + 54, ColourConverter.rgbToInt(r.getValue(), g.getValue(), b.getValue(), a.getValue()));
}
ResourceLocation box = getBox();
mc.renderEngine.bindTexture(box);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/zeroeightsix/kami/util/ColourConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public class ColourConverter {

public static float toF(double d) { return (float) (d / 255f); }

public static int settingsToInt(int r, int g, int b, int a) { return (r << 16) | (g << 8) | (b) | (a << 24); }
public static int rgbToInt(int r, int g, int b, int a) { return (r << 16) | (g << 8) | (b) | (a << 24); }

public static int settingsToInt(int r, int g, int b) { return (r << 16) | (g << 8) | (b); }
public static int rgbToInt(int r, int g, int b) { return (r << 16) | (g << 8) | (b); }

// settingsToInt(r.getValue(), g.getValue(), b.getValue(), aBlock.getValue()
}
6 changes: 3 additions & 3 deletions src/main/java/me/zeroeightsix/kami/util/ColourUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public static class ColourCodesMinecraft {
* Tool for getting Minecraft Textformatting Colors
*/
public enum ColourCode {
BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GREY, DARK_GREY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE
BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE
}
public static String getStringColour(ColourCode c) {
switch (c) {
Expand All @@ -338,8 +338,8 @@ public static String getStringColour(ColourCode c) {
case DARK_RED: return TextFormatting.DARK_RED.toString();
case DARK_PURPLE: return TextFormatting.DARK_PURPLE.toString();
case GOLD: return TextFormatting.GOLD.toString();
case GREY: return TextFormatting.GRAY.toString();
case DARK_GREY: return TextFormatting.DARK_GRAY.toString();
case GRAY: return TextFormatting.GRAY.toString();
case DARK_GRAY: return TextFormatting.DARK_GRAY.toString();
case BLUE: return TextFormatting.BLUE.toString();
case GREEN: return TextFormatting.GREEN.toString();
case AQUA: return TextFormatting.AQUA.toString();
Expand Down

0 comments on commit ff8323b

Please sign in to comment.