Skip to content

Commit

Permalink
Merge pull request #2 from joshuafhiggins/2.4.1
Browse files Browse the repository at this point in the history
Bug fix update 2.4.1
  • Loading branch information
joshuafhiggins authored Jun 21, 2023
2 parents aa29b76 + 1a4b557 commit fbc4753
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 44 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "2.4"
version = "2.4.1"
group= "me.toast.clickcounter" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "clickcounter"

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/toast/clicks/Clicks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Clicks {
public static final String MOD_ID = "clicks";
public static final String NAME = "Click Counter Mod";
public static final String VERSION = "v2.4.0";
public static final String VERSION = "v2.4.1";
public static boolean GUI_OPEN = false;
public static Settings SETTINGS = new Settings();

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/me/toast/clicks/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public static void CheckForUpdates() {

if (!latestVersion.equals(Clicks.VERSION)) {
mc.thePlayer.addChatMessage(new ChatComponentText("§2There is an update available for Click Counter at: https://github.com/joshuafhiggins/clickcounter/"));
} else {
mc.thePlayer.addChatMessage(new ChatComponentText("§7There are no updates available."));
}

System.out.println(latestVersion);
Expand Down
48 changes: 20 additions & 28 deletions src/main/java/me/toast/clicks/guis/GuiColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
public class GuiColor extends GuiScreen {
private GuiButton leftChroma;
private GuiButton leftShadow;
private GuiButton leftTestNewColor;
private GuiTextField leftRed;
private GuiTextField leftGreen;
private GuiTextField leftBlue;
private Color leftTestColor;

private GuiButton rightChroma;
private GuiButton rightShadow;
private GuiButton rightTestNewColor;
private GuiTextField rightRed;
private GuiTextField rightGreen;
private GuiTextField rightBlue;
Expand All @@ -38,15 +36,11 @@ public class GuiColor extends GuiScreen {
public void initGui() {
leftChroma = new GuiButton(0, width / 2 - 110, height / 2 + 25, 100, 20, "Chroma? " + Clicks.SETTINGS.getLeftChroma());
leftShadow = new GuiButton(1, width / 2 - 110, height / 2 + 50, 100, 20, "Shadow? " + Clicks.SETTINGS.getLeftShadow());
leftTestNewColor = new GuiButton(2, width / 2 - 110, height / 2 + 75, 100, 20, "Refresh Color");
buttonList.add(leftTestNewColor);
buttonList.add(leftChroma);
buttonList.add(leftShadow);

rightChroma = new GuiButton(3, width / 2 + 30, height / 2 + 25, 100, 20, "Chroma? " + Clicks.SETTINGS.getRightChroma());
rightShadow = new GuiButton(4, width / 2 + 30, height / 2 + 50, 100, 20, "Shadow? " + Clicks.SETTINGS.getRightShadow());
rightTestNewColor = new GuiButton(5, width / 2 + 30, height / 2 + 75, 100, 20, "Refresh Color");
buttonList.add(rightTestNewColor);
buttonList.add(rightChroma);
buttonList.add(rightShadow);

Expand Down Expand Up @@ -85,7 +79,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
leftRed.drawTextBox();
leftGreen.drawTextBox();
leftBlue.drawTextBox();
DrawText(fontRendererObj, "Test Color", width / 2 - 55, height / 2 + 125, leftTestColor.getRGB(), Clicks.SETTINGS.getLeftChroma(), Clicks.SETTINGS.getLeftShadow());
DrawText(fontRendererObj, "Test Color", width / 2 - 55, height / 2 + 75, leftTestColor.getRGB(), Clicks.SETTINGS.getLeftChroma(), Clicks.SETTINGS.getLeftShadow());
fontRendererObj.drawString("Red:", width / 2 - 13 - 70, (height / 2 - 62) - 50, -1);
fontRendererObj.drawString("Green:", width / 2 - 25 - 70, (height / 2 - 27) - 50, -1);
fontRendererObj.drawString("Blue:", width / 2 - 16 - 70, (height / 2 + 10) - 50, -1);
Expand All @@ -94,7 +88,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
rightRed.drawTextBox();
rightGreen.drawTextBox();
rightBlue.drawTextBox();
DrawText(fontRendererObj, "Test Color", width / 2 + 45, height / 2 + 125, rightTestColor.getRGB(), Clicks.SETTINGS.getRightChroma(), Clicks.SETTINGS.getRightShadow());
DrawText(fontRendererObj, "Test Color", width / 2 + 45, height / 2 + 75, rightTestColor.getRGB(), Clicks.SETTINGS.getRightChroma(), Clicks.SETTINGS.getRightShadow());
fontRendererObj.drawString("Red:", width / 2 - 13 + 35, (height / 2 - 62) - 50, -1);
fontRendererObj.drawString("Green:", width / 2 - 25 + 35, (height / 2 - 27) - 50, -1);
fontRendererObj.drawString("Blue:", width / 2 - 16 + 35, (height / 2 + 10) - 50, -1);
Expand All @@ -113,16 +107,6 @@ protected void actionPerformed(GuiButton button) throws IOException {
Clicks.SETTINGS.setLeftShadow();
leftShadow.displayString = "Shadow? " + Clicks.SETTINGS.getLeftShadow();
}
if (button == leftTestNewColor) {
try {
int redInt = Integer.parseInt(leftRed.getText());
int greenInt = Integer.parseInt(leftGreen.getText());
int blueInt = Integer.parseInt(leftBlue.getText());
leftTestColor = new Color(redInt, greenInt, blueInt);
} catch (NumberFormatException e) {
return;
}
}

if (button == rightChroma) {
Clicks.SETTINGS.setRightChroma();
Expand All @@ -132,16 +116,6 @@ protected void actionPerformed(GuiButton button) throws IOException {
Clicks.SETTINGS.setRightShadow();
rightShadow.displayString = "Shadow? " + Clicks.SETTINGS.getRightShadow();
}
if (button == rightTestNewColor) {
try {
int redInt = Integer.parseInt(rightRed.getText());
int greenInt = Integer.parseInt(rightGreen.getText());
int blueInt = Integer.parseInt(rightBlue.getText());
rightTestColor = new Color(redInt, greenInt, blueInt);
} catch (NumberFormatException e) {
return;
}
}

if (button == back)
mc.displayGuiScreen(new GuiMain());
Expand Down Expand Up @@ -184,6 +158,24 @@ protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (rightBlue.isFocused())
rightBlue.textboxKeyTyped(typedChar, keyCode);

try {
int redInt = Integer.parseInt(leftRed.getText());
int greenInt = Integer.parseInt(leftGreen.getText());
int blueInt = Integer.parseInt(leftBlue.getText());
leftTestColor = new Color(redInt, greenInt, blueInt);
} catch (NumberFormatException e) {
return;
}

try {
int redInt = Integer.parseInt(rightRed.getText());
int greenInt = Integer.parseInt(rightGreen.getText());
int blueInt = Integer.parseInt(rightBlue.getText());
rightTestColor = new Color(redInt, greenInt, blueInt);
} catch (NumberFormatException e) {
return;
}

super.keyTyped(typedChar, keyCode);
}

Expand Down
30 changes: 17 additions & 13 deletions src/main/java/me/toast/clicks/guis/GuiPosition.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,35 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {

@Override
protected void mouseClickMove(int mouseX, int mouseY, int mouseButton, long timeSinceLastClick) {
if (mouseButton != 0) {
super.mouseClickMove(mouseX, mouseY, mouseButton, timeSinceLastClick);
super.mouseClickMove(mouseX, mouseY, mouseButton, timeSinceLastClick);

if (mouseButton != 0)
return;
}

if (!leftIsFocused && TextIntersect(leftText, leftXPos, leftYPos, mouseX, mouseY)) {
leftIsFocused = true;
mc.thePlayer.addChatMessage(new ChatComponentText("Text Selected!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)));
}
if (leftIsFocused) {
leftXPos = mouseX;
leftYPos = mouseY;
return;
}


if (!rightIsFocused && TextIntersect(rightText, rightXPos, rightYPos, mouseX, mouseY)) {
rightIsFocused = true;
mc.thePlayer.addChatMessage(new ChatComponentText("Text Selected!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)));
}
if (rightIsFocused) {
rightXPos = mouseX;
rightYPos = mouseY;
return;
}

if (TextIntersect(leftText, leftXPos, leftYPos, mouseX, mouseY)) {
leftIsFocused = true;
mc.thePlayer.addChatMessage(new ChatComponentText("Text Selected!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)));
return;
}

if (TextIntersect(rightText, rightXPos, rightYPos, mouseX, mouseY)) {
rightIsFocused = true;
mc.thePlayer.addChatMessage(new ChatComponentText("Text Selected!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)));
//return;
}

super.mouseClickMove(mouseX, mouseY, mouseButton, timeSinceLastClick);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "clicks",
"name": "Click Counter Mod",
"description": "Counts how many times you left/right click.",
"version": "2.4.0",
"version": "2.4.1",
"mcversion": "1.8.9",
"url": "https://joshuafhiggins.github.io/categories/clickcounter",
"updateUrl": "",
Expand Down

0 comments on commit fbc4753

Please sign in to comment.