Skip to content

Commit 09928d0

Browse files
author
Samson
committed
Updated mod to 1.12.2
Also updated all staff, and simplified contribution
1 parent 285ffa9 commit 09928d0

17 files changed

+93
-97
lines changed

ModMain.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
1-
package qwertysam;
1+
package mcmstaffmod;
22

33
import org.lwjgl.input.Keyboard;
44

55
import net.minecraft.client.Minecraft;
66
import net.minecraft.client.gui.GuiScreen;
7-
import qwertysam.gui.ModGui;
8-
import qwertysam.io.Option;
9-
import qwertysam.io.OptionManager;
10-
import qwertysam.messages.api.MessageSender;
11-
import qwertysam.util.AuthUtil;
12-
import qwertysam.util.KeyPress;
7+
import mcmstaffmod.gui.ModGui;
8+
import mcmstaffmod.io.Option;
9+
import mcmstaffmod.io.OptionManager;
10+
import mcmstaffmod.messages.api.MessageSender;
11+
import mcmstaffmod.util.AuthUtil;
12+
import mcmstaffmod.util.KeyPress;
1313

1414
/**
1515
* Uses Timer.java from Minecraft src code.
16-
*
17-
* @version 2.1
1816
*/
1917
public class ModMain
2018
{
21-
public static final int KEYBOARD_SHORTCUT = AuthUtil.getUser().isEtian() ? Keyboard.KEY_G : Keyboard.KEY_GRAVE;
19+
// TODO Always change this to false before exporting
20+
public static final boolean debug = false;
21+
22+
private static ModMain inst = null;
23+
public static ModMain instance() {
24+
if (inst == null) inst = new ModMain();
25+
return inst;
26+
}
27+
28+
public static int KEYBOARD_SHORTCUT = Keyboard.KEY_G;
2229
private KeyPress triggerKey;
2330
private OptionManager options;
2431
private MessageSender messageSender;
2532

26-
// TODO Always change this to false before exporting
27-
public static final boolean debug = false;
28-
2933
public ModMain()
3034
{
31-
35+
KEYBOARD_SHORTCUT = AuthUtil.getUser() != null && AuthUtil.getUser().isEtian() ? Keyboard.KEY_G : Keyboard.KEY_GRAVE;
3236

3337
triggerKey = new KeyPress(KEYBOARD_SHORTCUT, true);
3438

@@ -48,18 +52,15 @@ public ModMain()
4852
*/
4953
public void gameLoop()
5054
{
51-
if (Minecraft.getMinecraft().currentScreen instanceof ModGui || Minecraft.getMinecraft().currentScreen == null) // Stops the GUI from opening while not in-game
55+
if (triggerKey.isPressed())
5256
{
53-
if (triggerKey.isPressed())
57+
if (Minecraft.getMinecraft().currentScreen instanceof ModGui) // Exits if it's already on the menu
58+
{
59+
Minecraft.getMinecraft().displayGuiScreen((GuiScreen) null);
60+
}
61+
else if (Minecraft.getMinecraft().currentScreen == null) // Stops the GUI from opening while not in-game
5462
{
55-
if (Minecraft.getMinecraft().currentScreen instanceof ModGui) // Exits if it's already on the menu
56-
{
57-
Minecraft.getMinecraft().displayGuiScreen((GuiScreen) null);
58-
}
59-
else // Goes to the menu if it's not there
60-
{
61-
Minecraft.getMinecraft().displayGuiScreen(new ModGui(this));
62-
}
63+
Minecraft.getMinecraft().displayGuiScreen(new ModGui(this));
6364
}
6465
}
6566
}

gui/GuiCustomEditor.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.gui;
1+
package mcmstaffmod.gui;
22

33
import java.io.IOException;
44

@@ -8,9 +8,9 @@
88
import net.minecraft.client.gui.GuiScreen;
99
import net.minecraft.client.gui.GuiTextField;
1010
import net.minecraft.client.resources.I18n;
11-
import qwertysam.ModMain;
12-
import qwertysam.io.OptionManager;
13-
import qwertysam.util.KeyPress;
11+
import mcmstaffmod.ModMain;
12+
import mcmstaffmod.io.OptionManager;
13+
import mcmstaffmod.util.KeyPress;
1414

1515
/**
1616
* The options menu for the backup mod.
@@ -154,7 +154,7 @@ public void initGui()
154154

155155
if (titleEdit)
156156
{
157-
customTitle = new GuiTextField(0, fontRendererObj, width / 2 - 104, 50, 100, 20);
157+
customTitle = new GuiTextField(0, fontRenderer, width / 2 - 104, 50, 100, 20);
158158
customTitle.setText(saveManager.getOption(customTitleKey).value());
159159
customTitle.setMaxStringLength(16);
160160
}
@@ -164,15 +164,15 @@ public void initGui()
164164
buttonList.add(new GuiIconButton(27, "Auto-Send Link", width / 2 + 108, 50, (saveManager.getOption(autoLinkKey).asBoolean() ? 120 : 140), 0));
165165
}
166166

167-
customLine1 = new GuiTextField(1, fontRendererObj, width / 2 - 200, 90, 400, 20);
167+
customLine1 = new GuiTextField(1, fontRenderer, width / 2 - 200, 90, 400, 20);
168168
customLine1.setMaxStringLength(100);
169169
customLine1.setText(saveManager.getOption(customLine1Key).value());
170170

171-
customLine2 = new GuiTextField(2, fontRendererObj, width / 2 - 200, 130, 400, 20);
171+
customLine2 = new GuiTextField(2, fontRenderer, width / 2 - 200, 130, 400, 20);
172172
customLine2.setMaxStringLength(100);
173173
customLine2.setText(saveManager.getOption(customLine2Key).value());
174174

175-
customLine3 = new GuiTextField(3, fontRendererObj, width / 2 - 200, 170, 400, 20);
175+
customLine3 = new GuiTextField(3, fontRenderer, width / 2 - 200, 170, 400, 20);
176176
customLine3.setMaxStringLength(100);
177177
customLine3.setText(saveManager.getOption(customLine3Key).value());
178178
}
@@ -282,23 +282,23 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks)
282282
drawDefaultBackground();
283283
super.drawScreen(mouseX, mouseY, partialTicks);
284284

285-
drawCenteredString(fontRendererObj, "Custom Preset Editor", width / 2, 18, 16777215);
285+
drawCenteredString(fontRenderer, "Custom Preset Editor", width / 2, 18, 16777215);
286286

287287
if (titleEdit)
288288
{
289-
drawString(fontRendererObj, "Title", width / 2 - 84, 38, 16777215);
289+
drawString(fontRenderer, "Title", width / 2 - 84, 38, 16777215);
290290
}
291291
else
292292
{
293293
// Renders the original title from the right
294-
drawString(fontRendererObj, customTitleKey, width / 2 - fontRendererObj.getStringWidth(customTitleKey) - 18, 56, 16777215);
294+
drawString(fontRenderer, customTitleKey, width / 2 - fontRenderer.getStringWidth(customTitleKey) - 18, 56, 16777215);
295295
}
296296

297-
drawString(fontRendererObj, "Line 1", width / 2 - 180, 78, 16777215);
297+
drawString(fontRenderer, "Line 1", width / 2 - 180, 78, 16777215);
298298

299-
drawString(fontRendererObj, "Line 2", width / 2 - 180, 118, 16777215);
299+
drawString(fontRenderer, "Line 2", width / 2 - 180, 118, 16777215);
300300

301-
drawString(fontRendererObj, "Line 3", width / 2 - 180, 158, 16777215);
301+
drawString(fontRenderer, "Line 3", width / 2 - 180, 158, 16777215);
302302

303303
if (titleEdit) customTitle.drawTextBox();
304304
customLine1.drawTextBox();

gui/GuiFloatingTextAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.gui;
1+
package mcmstaffmod.gui;
22

33
import java.util.ArrayList;
44
import java.util.List;

gui/GuiIconButton.java

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.gui;
1+
package mcmstaffmod.gui;
22

33
import net.minecraft.client.Minecraft;
44
import net.minecraft.client.gui.FontRenderer;
@@ -99,24 +99,11 @@ public GuiIconButton(int buttonID, String tooltip, int xPosition, int yPosition,
9999
* Draws this button to the screen.
100100
*/
101101
@Override
102-
public void drawButton(Minecraft mc, int mouseX, int mouseY)
102+
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks)
103103
{
104-
if (visible)
105-
{
106-
// Draws the Regular or texture pack'd minecraft button behind the decal.
107-
FontRenderer fontrenderer = mc.fontRendererObj;
108-
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
109-
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
110-
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
111-
int i = this.getHoverState(this.hovered);
112-
GlStateManager.enableBlend();
113-
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
114-
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
115-
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height);
116-
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
117-
this.mouseDragged(mc, mouseX, mouseY);
118-
119-
mc.getTextureManager().bindTexture(textureDir);
104+
super.drawButton(mc, mouseX, mouseY, partialTicks);
105+
if (visible) {
106+
mc.getTextureManager().bindTexture(textureDir);
120107
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
121108

122109
int tempYTextureOffset = yTextureOffset; // Used to bump the texture being drawn down in the image file to display it being hovered over or disabled.
@@ -130,7 +117,7 @@ else if (isMouseOver())
130117
tempYTextureOffset = yTextureOffset + yTextureSize;
131118
}
132119

133-
drawTexturedModalRect(xPosition, yPosition, xTextureOffset, tempYTextureOffset, width, height);
120+
drawTexturedModalRect(x, y, xTextureOffset, tempYTextureOffset, width, height);
134121
}
135122
}
136123

gui/ModGui.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package qwertysam.gui;
1+
package mcmstaffmod.gui;
22

33
import java.io.IOException;
44

55
import net.minecraft.client.gui.GuiButton;
66
import net.minecraft.client.gui.GuiScreen;
77
import net.minecraft.client.gui.GuiYesNo;
8-
import qwertysam.ModMain;
9-
import qwertysam.io.Option;
10-
import qwertysam.messages.api.MessageSender;
11-
import qwertysam.messages.api.MessageType;
12-
import qwertysam.messages.api.URL;
13-
import qwertysam.util.UrlOpener;
8+
import mcmstaffmod.ModMain;
9+
import mcmstaffmod.io.Option;
10+
import mcmstaffmod.messages.api.MessageSender;
11+
import mcmstaffmod.messages.api.MessageType;
12+
import mcmstaffmod.messages.api.URL;
13+
import mcmstaffmod.util.UrlOpener;
1414

1515
public class ModGui extends GuiFloatingTextAPI
1616
{
@@ -355,7 +355,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks)
355355
{
356356
super.drawScreen(mouseX, mouseY, partialTicks);
357357

358-
drawCenteredString(fontRendererObj, "Staff Tools", width / 2, spaceFromTop - 16, 16777215);
358+
drawCenteredString(fontRenderer, "Staff Tools", width / 2, spaceFromTop - 16, 16777215);
359359

360360
drawFloatingText(mouseX, mouseY);
361361
}

io/Option.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package qwertysam.io;
1+
package mcmstaffmod.io;
22

33
import java.util.ArrayList;
44
import java.util.List;
55

6-
import qwertysam.messages.api.MessageType;
7-
import qwertysam.messages.api.URL;
6+
import mcmstaffmod.messages.api.MessageType;
7+
import mcmstaffmod.messages.api.URL;
88

99
public enum Option
1010
{

io/OptionManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.io;
1+
package mcmstaffmod.io;
22

33
import java.io.BufferedReader;
44
import java.io.File;
@@ -9,9 +9,9 @@
99
import java.util.ArrayList;
1010
import java.util.List;
1111

12-
import qwertysam.log.LogType;
13-
import qwertysam.log.QLogger;
14-
import qwertysam.util.PathUtil;
12+
import mcmstaffmod.log.LogType;
13+
import mcmstaffmod.log.QLogger;
14+
import mcmstaffmod.util.PathUtil;
1515

1616
public class OptionManager
1717
{

log/LogType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.log;
1+
package mcmstaffmod.log;
22

33
import org.apache.logging.log4j.Level;
44

log/QLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qwertysam.log;
1+
package mcmstaffmod.log;
22

33
import org.apache.logging.log4j.LogManager;
44

messages/api/MessageSender.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package qwertysam.messages.api;
1+
package mcmstaffmod.messages.api;
22

33
import java.util.List;
44

55
import net.minecraft.client.Minecraft;
6-
import qwertysam.io.Option;
7-
import qwertysam.log.LogType;
8-
import qwertysam.log.QLogger;
6+
import mcmstaffmod.io.Option;
7+
import mcmstaffmod.log.LogType;
8+
import mcmstaffmod.log.QLogger;
99

1010
public class MessageSender
1111
{

0 commit comments

Comments
 (0)