Skip to content

Commit

Permalink
You can now switch the color of the mana bar (wip) and mana text from…
Browse files Browse the repository at this point in the history
… the menu.
  • Loading branch information
biscuut committed Jul 4, 2019
1 parent 1725464 commit b5add6d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY) {
boxColor = ConfigColor.GREEN.getColor(boxAlpha * alphaMultiplier);
}
} else if (feature.getButtonType() == Feature.ButtonType.COLOR) {
if (feature == Feature.WARNING_COLOR) {
boxColor = main.getConfigValues().getColor(Feature.WARNING_COLOR).getColor(boxAlpha*alphaMultiplier);
} else {
boxColor = main.getConfigValues().getColor(Feature.CONFIRMATION_COLOR).getColor(boxAlpha*alphaMultiplier);
}
boxColor = main.getConfigValues().getColor(feature).getColor(boxAlpha*alphaMultiplier);
} else if (feature.getButtonType() == Feature.ButtonType.MODIFY) {
if (hitMaximum()) {
boxColor = ConfigColor.GRAY.getColor(boxAlpha * alphaMultiplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ public void initGui() {
boxWidth = 100;
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-20, height*0.65, "Warning Color", main, Feature.WARNING_COLOR, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth+20, height*0.65, "Confirmation Color", main, Feature.CONFIRMATION_COLOR, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-20, height*0.73, null, main, Feature.WARNING_TIME, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth+20, height*0.73, "Edit Locations", main, Feature.EDIT_LOCATIONS, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-20, height*0.73, "Mana Text Color", main, Feature.MANA_TEXT_COLOR, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth+20, height*0.73, "Mana Bar Color", main, Feature.MANA_BAR_COLOR, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-20, height*0.81, null, main, Feature.WARNING_TIME, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth+20, height*0.81, "Edit Locations", main, Feature.EDIT_LOCATIONS, boxWidth, boxHeight));
boxWidth = 20;
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-125, height*0.73, "+", main, Feature.ADD, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth+5, height*0.73, "-", main, Feature.SUBTRACT, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth-125, height*0.81, "+", main, Feature.ADD, boxWidth, boxHeight));
buttonList.add(new ButtonRegular(0, halfWidth-boxWidth+5, height*0.81, "-", main, Feature.SUBTRACT, boxWidth, boxHeight));
}


Expand Down Expand Up @@ -98,11 +100,7 @@ protected void actionPerformed(GuiButton abstractButton) {
}
}
} else if (feature.getButtonType() == Feature.ButtonType.COLOR) {
if (feature == Feature.WARNING_COLOR) {
main.getConfigValues().setColor(Feature.WARNING_COLOR, main.getConfigValues().getColor(Feature.WARNING_COLOR).getNextColor());
} else {
main.getConfigValues().setColor(Feature.CONFIRMATION_COLOR, main.getConfigValues().getColor(Feature.CONFIRMATION_COLOR).getNextColor());
}
main.getConfigValues().setColor(feature, main.getConfigValues().getColor(feature).getNextColor());
} else if (feature.getButtonType() == Feature.ButtonType.MODIFY) {
if (feature == Feature.ADD) {
if (main.getConfigValues().getWarningSeconds() < 99) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
Expand All @@ -25,16 +26,14 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.awt.*;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Pattern;

import static net.minecraft.client.gui.Gui.icons;

public class PlayerListener {

public final static ItemStack BONE = new ItemStack(Item.getItemById(352));
private final static ResourceLocation manaBars = new ResourceLocation("skyblockaddons", "manabars.png");

private boolean sentUpdate = false;
private boolean predictMana = false;
Expand Down Expand Up @@ -119,7 +118,7 @@ public void onRenderManaBar(RenderGameOverlayEvent.Post e) {
Minecraft mc = Minecraft.getMinecraft();
if (e.type == RenderGameOverlayEvent.ElementType.EXPERIENCE && Utils.isOnSkyblock()) {
if (main.getConfigValues().getManaBarType() != Feature.ManaBarType.OFF && !(mc.currentScreen instanceof LocationEditGui)) {
mc.getTextureManager().bindTexture(icons);
mc.getTextureManager().bindTexture(manaBars);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();

Expand All @@ -133,14 +132,17 @@ public void onRenderManaBar(RenderGameOverlayEvent.Post e) {
if (manaFill > 1) manaFill = 1;
int filled = (int) (manaFill * barWidth);
int top = (int) (main.getConfigValues().getManaBarY() * sr.getScaledHeight()) + 10;
mc.ingameGUI.drawTexturedModalRect(left, top, 10, 84, barWidth, 5);
// mc.ingameGUI.drawTexturedModalRect(left, top, 10, 84, barWidth, 5);
int textureY = main.getConfigValues().getColor(Feature.MANA_BAR_COLOR).ordinal()*10;
mc.ingameGUI.drawTexturedModalRect(left, top, 0, textureY, barWidth, 5);
if (filled > 0) {
mc.ingameGUI.drawTexturedModalRect(left, top, 10, 89, filled, 5);
// mc.ingameGUI.drawTexturedModalRect(left, top, 10, 89, filled, 5);
mc.ingameGUI.drawTexturedModalRect(left, top, 0, textureY+5, filled, 5);
}
}
if (main.getConfigValues().getManaBarType() == Feature.ManaBarType.TEXT
|| main.getConfigValues().getManaBarType() == Feature.ManaBarType.BAR_TEXT) {
int color = new Color(47, 71, 249).getRGB();
int color = main.getConfigValues().getColor(Feature.MANA_TEXT_COLOR).getColor(255);
String text = mana + "/" + maxMana;
int x = (int) (main.getConfigValues().getManaBarX() * sr.getScaledWidth()) + 60 - mc.ingameGUI.getFontRenderer().getStringWidth(text) / 2;
int y = (int) (main.getConfigValues().getManaBarY() * sr.getScaledHeight()) + 4;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b5add6d

Please sign in to comment.