Skip to content

Commit 6f5f5a0

Browse files
tally hall
1 parent 815371b commit 6f5f5a0

File tree

99 files changed

+13524
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+13524
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
3+
4+
5+
package com.gamesense.client;
6+
7+
import net.minecraftforge.fml.common.*;
8+
import com.gamesense.api.util.misc.*;
9+
import com.gamesense.api.event.*;
10+
import com.gamesense.api.util.font.*;
11+
import com.gamesense.api.setting.*;
12+
import com.gamesense.api.util.player.friend.*;
13+
import com.gamesense.api.util.player.enemy.*;
14+
import com.gamesense.client.clickgui.*;
15+
import com.gamesense.api.util.render.*;
16+
import net.minecraftforge.fml.common.event.*;
17+
import org.lwjgl.opengl.*;
18+
import java.awt.*;
19+
import com.gamesense.client.module.*;
20+
import com.gamesense.client.command.*;
21+
import com.gamesense.api.config.*;
22+
import org.apache.logging.log4j.*;
23+
import me.zero.alpine.*;
24+
25+
@Mod(modid = "kiefsense", name = "KiefSense", version = "v0.0.1")
26+
public class GameSense
27+
{
28+
public static final String MODNAME = "KiefSense";
29+
public static final String MODID = "kiefsense";
30+
public static final String MODVER = "v0.0.1";
31+
public static final Logger LOGGER;
32+
public static final EventBus EVENT_BUS;
33+
@Mod.Instance
34+
private static GameSense INSTANCE;
35+
public VersionChecker versionChecker;
36+
public EventProcessor eventProcessor;
37+
public CFontRenderer cFontRenderer;
38+
public SettingsManager settingsManager;
39+
public Friends friends;
40+
public Enemies enemies;
41+
public GameSenseGUI gameSenseGUI;
42+
public SaveConfig saveConfig;
43+
public LoadConfig loadConfig;
44+
public CapeUtil capeUtil;
45+
46+
public GameSense() {
47+
GameSense.INSTANCE = this;
48+
}
49+
50+
public static GameSense getInstance() {
51+
return GameSense.INSTANCE;
52+
}
53+
54+
@Mod.EventHandler
55+
public void init(final FMLInitializationEvent event) {
56+
Display.setTitle("KiefSense v0.0.1");
57+
GameSense.LOGGER.info("Starting up KiefSense v0.0.1!");
58+
this.startClient();
59+
GameSense.LOGGER.info("Finished initialization for KiefSense v0.0.1!");
60+
}
61+
62+
private void startClient() {
63+
GameSense.LOGGER.info("Version checked!");
64+
(this.eventProcessor = new EventProcessor()).init();
65+
GameSense.LOGGER.info("Events initialized!");
66+
this.cFontRenderer = new CFontRenderer(new Font("Verdana", 0, 18), true, true);
67+
GameSense.LOGGER.info("Custom font initialized!");
68+
this.settingsManager = new SettingsManager();
69+
GameSense.LOGGER.info("Settings initialized!");
70+
this.friends = new Friends();
71+
this.enemies = new Enemies();
72+
GameSense.LOGGER.info("Friends and enemies initialized!");
73+
ModuleManager.init();
74+
GameSense.LOGGER.info("Modules initialized!");
75+
this.gameSenseGUI = new GameSenseGUI();
76+
GameSense.LOGGER.info("GameSenseGUI initialized!");
77+
CommandManager.registerCommands();
78+
GameSense.LOGGER.info("Commands initialized!");
79+
this.saveConfig = new SaveConfig();
80+
this.loadConfig = new LoadConfig();
81+
Runtime.getRuntime().addShutdownHook((Thread)new ConfigStopper());
82+
GameSense.LOGGER.info("Config initialized!");
83+
this.capeUtil = new CapeUtil();
84+
GameSense.LOGGER.info("Capes initialized!");
85+
}
86+
87+
static {
88+
LOGGER = LogManager.getLogger("KiefSense");
89+
EVENT_BUS = (EventBus)new EventManager();
90+
}
91+
}
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
2+
3+
4+
5+
package com.gamesense.client.clickgui;
6+
7+
import com.gamesense.client.module.modules.gui.*;
8+
import java.awt.*;
9+
import com.lukflug.panelstudio.mc12.*;
10+
import com.gamesense.api.util.render.*;
11+
import com.gamesense.api.util.font.*;
12+
import java.util.*;
13+
import com.gamesense.client.module.*;
14+
import com.lukflug.panelstudio.hud.*;
15+
import com.lukflug.panelstudio.theme.*;
16+
import com.lukflug.panelstudio.*;
17+
import com.gamesense.client.*;
18+
import com.gamesense.api.setting.*;
19+
import com.lukflug.panelstudio.settings.*;
20+
import net.minecraft.item.*;
21+
import org.lwjgl.opengl.*;
22+
import net.minecraft.client.*;
23+
import net.minecraft.client.renderer.*;
24+
import net.minecraft.entity.*;
25+
import net.minecraft.client.gui.inventory.*;
26+
27+
public class GameSenseGUI extends MinecraftHUDGUI
28+
{
29+
public static final int WIDTH = 100;
30+
public static final int HEIGHT = 12;
31+
public static final int DISTANCE = 10;
32+
public static final int HUD_BORDER = 2;
33+
private final Toggleable colorToggle;
34+
public final GUIInterface guiInterface;
35+
public final HUDClickGUI gui;
36+
private final Theme theme;
37+
private final Theme gamesenseTheme;
38+
private final Theme clearTheme;
39+
private final Theme cleargradientTheme;
40+
41+
public GameSenseGUI() {
42+
final ColorScheme scheme = new SettingsColorScheme((ColorSetting)ClickGuiModule.enabledColor, (ColorSetting)ClickGuiModule.backgroundColor, (ColorSetting)ClickGuiModule.settingBackgroundColor, (ColorSetting)ClickGuiModule.outlineColor, (ColorSetting)ClickGuiModule.fontColor, (NumberSetting)ClickGuiModule.opacity);
43+
this.gamesenseTheme = new GameSenseTheme(scheme, 12, 2, 5);
44+
this.clearTheme = new ClearTheme(scheme, false, 12, 1);
45+
this.cleargradientTheme = new ClearTheme(scheme, true, 12, 1);
46+
this.theme = new ThemeMultiplexer() {
47+
@Override
48+
protected Theme getTheme() {
49+
if (ClickGuiModule.theme.getValue().equals("2.0")) {
50+
return GameSenseGUI.this.clearTheme;
51+
}
52+
if (ClickGuiModule.theme.getValue().equals("2.1.2")) {
53+
return GameSenseGUI.this.cleargradientTheme;
54+
}
55+
return GameSenseGUI.this.gamesenseTheme;
56+
}
57+
};
58+
this.colorToggle = new Toggleable() {
59+
@Override
60+
public void toggle() {
61+
ColorMain.colorModel.increment();
62+
}
63+
64+
@Override
65+
public boolean isOn() {
66+
return ColorMain.colorModel.getValue().equals("HSB");
67+
}
68+
};
69+
this.guiInterface = new GUIInterface(true) {
70+
@Override
71+
public void drawString(final Point pos, final String s, final Color c) {
72+
GLInterface.end();
73+
int x = pos.x + 2;
74+
int y = pos.y + 1;
75+
if (!ColorMain.customFont.getValue()) {
76+
++x;
77+
++y;
78+
}
79+
FontUtil.drawStringWithShadow(ColorMain.customFont.getValue(), s, x, y, new GSColor(c));
80+
GLInterface.begin();
81+
}
82+
83+
@Override
84+
public int getFontWidth(final String s) {
85+
return Math.round((float)FontUtil.getStringWidth(ColorMain.customFont.getValue(), s)) + 4;
86+
}
87+
88+
@Override
89+
public int getFontHeight() {
90+
return Math.round((float)FontUtil.getFontHeight(ColorMain.customFont.getValue())) + 2;
91+
}
92+
93+
public String getResourcePrefix() {
94+
return "gamesense:gui/";
95+
}
96+
};
97+
this.gui = new HUDClickGUI(this.guiInterface, null) {
98+
@Override
99+
public void handleScroll(final int diff) {
100+
super.handleScroll(diff);
101+
if (ClickGuiModule.scrolling.getValue().equals("Screen")) {
102+
for (final FixedComponent component : this.components) {
103+
if (!this.hudComponents.contains(component)) {
104+
final Point p = component.getPosition(GameSenseGUI.this.guiInterface);
105+
p.translate(0, -diff);
106+
component.setPosition(GameSenseGUI.this.guiInterface, p);
107+
}
108+
}
109+
}
110+
}
111+
};
112+
final Toggleable hudToggle = new Toggleable() {
113+
@Override
114+
public void toggle() {
115+
}
116+
117+
@Override
118+
public boolean isOn() {
119+
return (GameSenseGUI.this.gui.isOn() && ClickGuiModule.showHUD.isOn()) || GameSenseGUI.this.hudEditor;
120+
}
121+
};
122+
for (final Module module : ModuleManager.getModules()) {
123+
if (module instanceof HUDModule) {
124+
((HUDModule)module).populate(this.theme);
125+
this.gui.addHUDComponent(new HUDPanel(((HUDModule)module).getComponent(), this.theme.getPanelRenderer(), module, new SettingsAnimation((NumberSetting)ClickGuiModule.animationSpeed), hudToggle, 2));
126+
}
127+
}
128+
final Point pos = new Point(10, 10);
129+
for (final Module.Category category : Module.Category.values()) {
130+
final DraggableContainer panel = new DraggableContainer(category.name(), null, this.theme.getPanelRenderer(), new SimpleToggleable(false), new SettingsAnimation((NumberSetting)ClickGuiModule.animationSpeed), null, new Point(pos), 100) {
131+
@Override
132+
protected int getScrollHeight(final int childHeight) {
133+
if (ClickGuiModule.scrolling.getValue().equals("Screen")) {
134+
return childHeight;
135+
}
136+
return Math.min(childHeight, Math.max(48, GameSenseGUI.this.height - this.getPosition(GameSenseGUI.this.guiInterface).y - this.renderer.getHeight(this.open.getValue() != 0.0) - 12));
137+
}
138+
};
139+
this.gui.addComponent(panel);
140+
pos.translate(110, 0);
141+
for (final Module module2 : ModuleManager.getModulesInCategory(category)) {
142+
this.addModule(panel, module2);
143+
}
144+
}
145+
}
146+
147+
private void addModule(final CollapsibleContainer panel, final Module module) {
148+
final CollapsibleContainer container = new CollapsibleContainer(module.getName(), null, this.theme.getContainerRenderer(), new SimpleToggleable(false), new SettingsAnimation((NumberSetting)ClickGuiModule.animationSpeed), module);
149+
panel.addComponent(container);
150+
for (final Setting property : GameSense.getInstance().settingsManager.getSettingsForMod(module)) {
151+
if (property instanceof Setting.Boolean) {
152+
container.addComponent(new BooleanComponent(property.getName(), null, this.theme.getComponentRenderer(), (Toggleable)property));
153+
}
154+
else if (property instanceof Setting.Integer) {
155+
container.addComponent(new NumberComponent(property.getName(), null, this.theme.getComponentRenderer(), (NumberSetting)property, ((Setting.Integer)property).getMin(), ((Setting.Integer)property).getMax()));
156+
}
157+
else if (property instanceof Setting.Double) {
158+
container.addComponent(new NumberComponent(property.getName(), null, this.theme.getComponentRenderer(), (NumberSetting)property, ((Setting.Double)property).getMin(), ((Setting.Double)property).getMax()));
159+
}
160+
else if (property instanceof Setting.Mode) {
161+
container.addComponent(new EnumComponent(property.getName(), null, this.theme.getComponentRenderer(), (EnumSetting)property));
162+
}
163+
else {
164+
if (!(property instanceof Setting.ColorSetting)) {
165+
continue;
166+
}
167+
container.addComponent(new SyncableColorComponent(this.theme, (Setting.ColorSetting)property, this.colorToggle, new SettingsAnimation((NumberSetting)ClickGuiModule.animationSpeed)));
168+
}
169+
}
170+
container.addComponent(new GameSenseKeybind(this.theme.getComponentRenderer(), module));
171+
}
172+
173+
public static void renderItem(final ItemStack item, final Point pos) {
174+
GlStateManager.enableTexture2D();
175+
GlStateManager.depthMask(true);
176+
GL11.glPushAttrib(524288);
177+
GL11.glDisable(3089);
178+
GlStateManager.clear(256);
179+
GL11.glPopAttrib();
180+
GlStateManager.enableDepth();
181+
GlStateManager.disableAlpha();
182+
GlStateManager.pushMatrix();
183+
Minecraft.getMinecraft().getRenderItem().zLevel = -150.0f;
184+
RenderHelper.enableGUIStandardItemLighting();
185+
Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(item, pos.x, pos.y);
186+
Minecraft.getMinecraft().getRenderItem().renderItemOverlays(Minecraft.getMinecraft().fontRendererObj, item, pos.x, pos.y);
187+
RenderHelper.disableStandardItemLighting();
188+
Minecraft.getMinecraft().getRenderItem().zLevel = 0.0f;
189+
GlStateManager.popMatrix();
190+
GlStateManager.disableDepth();
191+
GlStateManager.depthMask(false);
192+
GLInterface.begin();
193+
}
194+
195+
public static void renderEntity(final EntityLivingBase entity, final Point pos, final int scale) {
196+
GlStateManager.enableTexture2D();
197+
GlStateManager.depthMask(true);
198+
GL11.glPushAttrib(524288);
199+
GL11.glDisable(3089);
200+
GlStateManager.clear(256);
201+
GL11.glPopAttrib();
202+
GlStateManager.enableDepth();
203+
GlStateManager.disableAlpha();
204+
GlStateManager.pushMatrix();
205+
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
206+
GuiInventory.drawEntityOnScreen(pos.x, pos.y, scale, 28.0f, 60.0f, entity);
207+
GlStateManager.popMatrix();
208+
GlStateManager.disableDepth();
209+
GlStateManager.depthMask(false);
210+
GLInterface.begin();
211+
}
212+
213+
@Override
214+
protected HUDClickGUI getHUDGUI() {
215+
return this.gui;
216+
}
217+
218+
@Override
219+
protected GUIInterface getInterface() {
220+
return this.guiInterface;
221+
}
222+
223+
@Override
224+
protected int getScrollSpeed() {
225+
return ClickGuiModule.scrollSpeed.getValue();
226+
}
227+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
3+
4+
5+
package com.gamesense.client.clickgui;
6+
7+
import com.lukflug.panelstudio.theme.*;
8+
import com.lukflug.panelstudio.settings.*;
9+
import com.lukflug.panelstudio.*;
10+
11+
public class GameSenseKeybind extends KeybindComponent
12+
{
13+
public GameSenseKeybind(final Renderer renderer, final KeybindSetting keybind) {
14+
super(renderer, keybind);
15+
}
16+
17+
@Override
18+
public void handleKey(final Context context, final int scancode) {
19+
context.setHeight(this.renderer.getHeight(false));
20+
if (this.hasFocus(context) && scancode == 211) {
21+
this.keybind.setKey(0);
22+
this.releaseFocus();
23+
return;
24+
}
25+
super.handleKey(context, scancode);
26+
}
27+
}

0 commit comments

Comments
 (0)