Skip to content

Commit a078a39

Browse files
committed
1.1 - Add a lot of new features (code in a poor state, will be rewritten)
1 parent 2dbc78a commit a078a39

File tree

12 files changed

+666
-106
lines changed

12 files changed

+666
-106
lines changed

src/main/java/com/shinycraft/streamermod/StreamerMod.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.shinycraft.streamermod;
22

3+
import com.shinycraft.streamermod.keybinds.GameModeKeyBind;
4+
import com.shinycraft.streamermod.keybinds.SpectatorHighlightKeyBind;
35
import com.shinycraft.streamermod.listeners.RenderListener;
46
import com.shinycraft.streamermod.renderer.ModRenderer;
7+
import com.shinycraft.streamermod.renderer.ScreenDisplay;
58
import net.minecraftforge.common.MinecraftForge;
69
import net.minecraftforge.common.config.Configuration;
710
import net.minecraftforge.fml.common.FMLCommonHandler;
@@ -22,11 +25,24 @@ public class StreamerMod
2225
public static File team2File;
2326
public static int defaultYLevel = 16;
2427
public static boolean scoreboard = true;
28+
public static boolean playerDisplay = true;
29+
public static boolean coreLeakDistance = true;
30+
public static File timeFile;
31+
public static File mapNameFile;
32+
public static File team1ColorInput;
33+
public static File team1ColorOutput;
34+
public static File team2ColorInput;
35+
public static File team2ColorOutput;
36+
37+
public static boolean seePlayerHighlights = false;
38+
public static ScreenDisplay screenDisplay;
2539

2640
@EventHandler
2741
public void init(FMLInitializationEvent event) {
2842
MinecraftForge.EVENT_BUS.register(RenderListener.instance);
2943
FMLCommonHandler.instance().bus().register(new GameModeKeyBind());
44+
FMLCommonHandler.instance().bus().register(new SpectatorHighlightKeyBind());
45+
screenDisplay = new ScreenDisplay();
3046
}
3147

3248
@EventHandler
@@ -38,12 +54,18 @@ public void preInit(FMLPreInitializationEvent event) {
3854
config.save();
3955
String team1FileString = config.getString("Team1txtFile", Configuration.CATEGORY_GENERAL, "team1.txt", "This is where the first team's name will export to");
4056
String team2FileString = config.getString("Team2txtFile", Configuration.CATEGORY_GENERAL, "team2.txt", "This is where the second team's name will export to");
41-
int y = config.getInt("defaultGUIyLevel", Configuration.CATEGORY_GENERAL, 16, 0, 1980, "How far down the GUI starts");
42-
boolean sb = config.getBoolean("scoreboardEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the scoreboard");
57+
defaultYLevel = config.getInt("DefaultGUIyLevel", Configuration.CATEGORY_GENERAL, 16, 0, 1980, "How far down the GUI starts");
58+
scoreboard = config.getBoolean("ScoreboardEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the scoreboard");
59+
playerDisplay = config.getBoolean("PlayerDisplayEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the player display");
60+
coreLeakDistance = config.getBoolean("CoreLeakDistanceEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the core leak distance display");
61+
timeFile = new File(config.getString("TimetxtFile", Configuration.CATEGORY_GENERAL, "time.txt", "Displays how much time is left in a match"));
62+
mapNameFile = new File(config.getString("MapNametxtFile", Configuration.CATEGORY_GENERAL, "mapname.txt", "Shows what map is currently being played"));
63+
team1ColorInput = new File(config.getString("Team1OverlayInputFile", Configuration.CATEGORY_GENERAL, "team1overlayinput.png", "Links the template required for team 1's color changing overlay output"));
64+
team1ColorOutput = new File(config.getString("Team1OverlayOutputFile", Configuration.CATEGORY_GENERAL, "team1overlayoutput.png", "An image that is colored based on team 1's color"));
65+
team2ColorInput = new File(config.getString("Team2OverlayInputFile", Configuration.CATEGORY_GENERAL, "team2overlayinput.png", "Links the template required for team 2's color changing overlay output"));
66+
team2ColorOutput = new File(config.getString("Team2OverlayOutputFile", Configuration.CATEGORY_GENERAL, "team2overlayoutput.png", "An image that is colored based on team 2's color"));
4367
team1File = new File(team1FileString);
4468
team2File = new File(team2FileString);
45-
defaultYLevel = y;
46-
scoreboard = sb;
4769
config.load();
4870
config.save();
4971
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.shinycraft.streamermod.events;
2+
3+
/**
4+
* Created by ShinyDialga45 on 11/6/2015.
5+
*/
6+
public class XMLUpdateEvent {
7+
8+
9+
10+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.shinycraft.streamermod.keybinds;
2+
3+
import com.shinycraft.streamermod.StreamerMod;
4+
import net.minecraft.client.Minecraft;
5+
import net.minecraft.client.gui.GuiChat;
6+
import net.minecraft.client.settings.KeyBinding;
7+
import net.minecraft.server.MinecraftServer;
8+
import net.minecraft.world.WorldSettings;
9+
import net.minecraftforge.fml.client.FMLClientHandler;
10+
import net.minecraftforge.fml.client.registry.ClientRegistry;
11+
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
12+
import net.minecraftforge.fml.common.gameevent.InputEvent;
13+
import org.lwjgl.input.Keyboard;
14+
15+
import java.util.EnumSet;
16+
17+
/**
18+
* Created by ShinyDialga45 on 8/22/2015.
19+
*/
20+
public class GameModeKeyBind {
21+
22+
/** Key index for easy handling */
23+
public static final int CUSTOM_INV = 0;
24+
/** Key descriptions; use a language file to localize the description later */
25+
private static final String[] desc = {"Toggle Creative/Spectator mode"};
26+
/** Default key values */
27+
private static final int[] keyValues = {Keyboard.KEY_P};
28+
private final KeyBinding[] keys;
29+
30+
public GameModeKeyBind() {
31+
keys = new KeyBinding[desc.length];
32+
for (int i = 0; i < desc.length; ++i) {
33+
keys[i] = new KeyBinding(desc[i], keyValues[i], "Streamer Mod");
34+
ClientRegistry.registerKeyBinding(keys[i]);
35+
}
36+
}
37+
38+
/**
39+
* KeyInputEvent is in the FML package, so we must register to the FML event bus
40+
*/
41+
@SubscribeEvent
42+
public void onKeyInput(InputEvent.KeyInputEvent event) {
43+
if (keys[CUSTOM_INV].isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
44+
if (Minecraft.getMinecraft().playerController.getCurrentGameType().equals(WorldSettings.GameType.CREATIVE)) {
45+
Minecraft.getMinecraft().thePlayer.sendChatMessage("/gamemode 3");
46+
} else if (Minecraft.getMinecraft().playerController.getCurrentGameType().equals(WorldSettings.GameType.SPECTATOR)) {
47+
Minecraft.getMinecraft().thePlayer.sendChatMessage("/gamemode 1");
48+
}
49+
}
50+
}
51+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.shinycraft.streamermod.keybinds;
2+
3+
import com.shinycraft.streamermod.StreamerMod;
4+
import net.minecraft.client.Minecraft;
5+
import net.minecraft.client.settings.KeyBinding;
6+
import net.minecraft.world.WorldSettings;
7+
import net.minecraftforge.fml.client.FMLClientHandler;
8+
import net.minecraftforge.fml.client.registry.ClientRegistry;
9+
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
10+
import net.minecraftforge.fml.common.gameevent.InputEvent;
11+
import org.lwjgl.input.Keyboard;
12+
13+
/**
14+
* Created by ShinyDialga45 on 8/22/2015.
15+
*/
16+
public class SpectatorHighlightKeyBind {
17+
18+
/** Key index for easy handling */
19+
public static final int CUSTOM_INV = 0;
20+
/** Key descriptions; use a language file to localize the description later */
21+
private static final String[] desc = {"See lines through players"};
22+
/** Default key values */
23+
private static final int[] keyValues = {Keyboard.KEY_B};
24+
private final KeyBinding[] keys;
25+
26+
public SpectatorHighlightKeyBind() {
27+
keys = new KeyBinding[desc.length];
28+
for (int i = 0; i < desc.length; ++i) {
29+
keys[i] = new KeyBinding(desc[i], keyValues[i], "Streamer Mod");
30+
ClientRegistry.registerKeyBinding(keys[i]);
31+
}
32+
}
33+
34+
/**
35+
* KeyInputEvent is in the FML package, so we must register to the FML event bus
36+
*/
37+
@SubscribeEvent
38+
public void onKeyInput(InputEvent.KeyInputEvent event) {
39+
if (keys[CUSTOM_INV].isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
40+
StreamerMod.seePlayerHighlights = !StreamerMod.seePlayerHighlights;
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)