-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.1 - Add a lot of new features (code in a poor state, will be rewrit…
…ten)
- Loading branch information
1 parent
2dbc78a
commit a078a39
Showing
12 changed files
with
666 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.shinycraft.streamermod; | ||
|
||
import com.shinycraft.streamermod.keybinds.GameModeKeyBind; | ||
import com.shinycraft.streamermod.keybinds.SpectatorHighlightKeyBind; | ||
import com.shinycraft.streamermod.listeners.RenderListener; | ||
import com.shinycraft.streamermod.renderer.ModRenderer; | ||
import com.shinycraft.streamermod.renderer.ScreenDisplay; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.common.config.Configuration; | ||
import net.minecraftforge.fml.common.FMLCommonHandler; | ||
|
@@ -22,11 +25,24 @@ public class StreamerMod | |
public static File team2File; | ||
public static int defaultYLevel = 16; | ||
public static boolean scoreboard = true; | ||
public static boolean playerDisplay = true; | ||
public static boolean coreLeakDistance = true; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ShinyDialga
Author
Owner
|
||
public static File timeFile; | ||
public static File mapNameFile; | ||
public static File team1ColorInput; | ||
public static File team1ColorOutput; | ||
public static File team2ColorInput; | ||
public static File team2ColorOutput; | ||
|
||
public static boolean seePlayerHighlights = false; | ||
public static ScreenDisplay screenDisplay; | ||
|
||
@EventHandler | ||
public void init(FMLInitializationEvent event) { | ||
MinecraftForge.EVENT_BUS.register(RenderListener.instance); | ||
FMLCommonHandler.instance().bus().register(new GameModeKeyBind()); | ||
FMLCommonHandler.instance().bus().register(new SpectatorHighlightKeyBind()); | ||
screenDisplay = new ScreenDisplay(); | ||
} | ||
|
||
@EventHandler | ||
|
@@ -38,12 +54,18 @@ public void preInit(FMLPreInitializationEvent event) { | |
config.save(); | ||
String team1FileString = config.getString("Team1txtFile", Configuration.CATEGORY_GENERAL, "team1.txt", "This is where the first team's name will export to"); | ||
String team2FileString = config.getString("Team2txtFile", Configuration.CATEGORY_GENERAL, "team2.txt", "This is where the second team's name will export to"); | ||
int y = config.getInt("defaultGUIyLevel", Configuration.CATEGORY_GENERAL, 16, 0, 1980, "How far down the GUI starts"); | ||
boolean sb = config.getBoolean("scoreboardEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the scoreboard"); | ||
defaultYLevel = config.getInt("DefaultGUIyLevel", Configuration.CATEGORY_GENERAL, 16, 0, 1980, "How far down the GUI starts"); | ||
scoreboard = config.getBoolean("ScoreboardEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the scoreboard"); | ||
playerDisplay = config.getBoolean("PlayerDisplayEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the player display"); | ||
coreLeakDistance = config.getBoolean("CoreLeakDistanceEnabled", Configuration.CATEGORY_GENERAL, true, "Enables the core leak distance display"); | ||
timeFile = new File(config.getString("TimetxtFile", Configuration.CATEGORY_GENERAL, "time.txt", "Displays how much time is left in a match")); | ||
mapNameFile = new File(config.getString("MapNametxtFile", Configuration.CATEGORY_GENERAL, "mapname.txt", "Shows what map is currently being played")); | ||
team1ColorInput = new File(config.getString("Team1OverlayInputFile", Configuration.CATEGORY_GENERAL, "team1overlayinput.png", "Links the template required for team 1's color changing overlay output")); | ||
team1ColorOutput = new File(config.getString("Team1OverlayOutputFile", Configuration.CATEGORY_GENERAL, "team1overlayoutput.png", "An image that is colored based on team 1's color")); | ||
team2ColorInput = new File(config.getString("Team2OverlayInputFile", Configuration.CATEGORY_GENERAL, "team2overlayinput.png", "Links the template required for team 2's color changing overlay output")); | ||
team2ColorOutput = new File(config.getString("Team2OverlayOutputFile", Configuration.CATEGORY_GENERAL, "team2overlayoutput.png", "An image that is colored based on team 2's color")); | ||
team1File = new File(team1FileString); | ||
team2File = new File(team2FileString); | ||
defaultYLevel = y; | ||
scoreboard = sb; | ||
config.load(); | ||
config.save(); | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/main/java/com/shinycraft/streamermod/events/XMLUpdateEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.shinycraft.streamermod.events; | ||
|
||
/** | ||
* Created by ShinyDialga45 on 11/6/2015. | ||
*/ | ||
public class XMLUpdateEvent { | ||
|
||
|
||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/shinycraft/streamermod/keybinds/GameModeKeyBind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.shinycraft.streamermod.keybinds; | ||
|
||
import com.shinycraft.streamermod.StreamerMod; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiChat; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.world.WorldSettings; | ||
import net.minecraftforge.fml.client.FMLClientHandler; | ||
import net.minecraftforge.fml.client.registry.ClientRegistry; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.InputEvent; | ||
import org.lwjgl.input.Keyboard; | ||
|
||
import java.util.EnumSet; | ||
|
||
/** | ||
* Created by ShinyDialga45 on 8/22/2015. | ||
*/ | ||
public class GameModeKeyBind { | ||
|
||
/** Key index for easy handling */ | ||
public static final int CUSTOM_INV = 0; | ||
/** Key descriptions; use a language file to localize the description later */ | ||
private static final String[] desc = {"Toggle Creative/Spectator mode"}; | ||
/** Default key values */ | ||
private static final int[] keyValues = {Keyboard.KEY_P}; | ||
private final KeyBinding[] keys; | ||
|
||
public GameModeKeyBind() { | ||
keys = new KeyBinding[desc.length]; | ||
for (int i = 0; i < desc.length; ++i) { | ||
keys[i] = new KeyBinding(desc[i], keyValues[i], "Streamer Mod"); | ||
ClientRegistry.registerKeyBinding(keys[i]); | ||
} | ||
} | ||
|
||
/** | ||
* KeyInputEvent is in the FML package, so we must register to the FML event bus | ||
*/ | ||
@SubscribeEvent | ||
public void onKeyInput(InputEvent.KeyInputEvent event) { | ||
if (keys[CUSTOM_INV].isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) { | ||
if (Minecraft.getMinecraft().playerController.getCurrentGameType().equals(WorldSettings.GameType.CREATIVE)) { | ||
Minecraft.getMinecraft().thePlayer.sendChatMessage("/gamemode 3"); | ||
} else if (Minecraft.getMinecraft().playerController.getCurrentGameType().equals(WorldSettings.GameType.SPECTATOR)) { | ||
Minecraft.getMinecraft().thePlayer.sendChatMessage("/gamemode 1"); | ||
} | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/shinycraft/streamermod/keybinds/SpectatorHighlightKeyBind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.shinycraft.streamermod.keybinds; | ||
|
||
import com.shinycraft.streamermod.StreamerMod; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import net.minecraft.world.WorldSettings; | ||
import net.minecraftforge.fml.client.FMLClientHandler; | ||
import net.minecraftforge.fml.client.registry.ClientRegistry; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.InputEvent; | ||
import org.lwjgl.input.Keyboard; | ||
|
||
/** | ||
* Created by ShinyDialga45 on 8/22/2015. | ||
*/ | ||
public class SpectatorHighlightKeyBind { | ||
|
||
/** Key index for easy handling */ | ||
public static final int CUSTOM_INV = 0; | ||
/** Key descriptions; use a language file to localize the description later */ | ||
private static final String[] desc = {"See lines through players"}; | ||
/** Default key values */ | ||
private static final int[] keyValues = {Keyboard.KEY_B}; | ||
private final KeyBinding[] keys; | ||
|
||
public SpectatorHighlightKeyBind() { | ||
keys = new KeyBinding[desc.length]; | ||
for (int i = 0; i < desc.length; ++i) { | ||
keys[i] = new KeyBinding(desc[i], keyValues[i], "Streamer Mod"); | ||
ClientRegistry.registerKeyBinding(keys[i]); | ||
} | ||
} | ||
|
||
/** | ||
* KeyInputEvent is in the FML package, so we must register to the FML event bus | ||
*/ | ||
@SubscribeEvent | ||
public void onKeyInput(InputEvent.KeyInputEvent event) { | ||
if (keys[CUSTOM_INV].isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) { | ||
StreamerMod.seePlayerHighlights = !StreamerMod.seePlayerHighlights; | ||
} | ||
} | ||
} |
Oops, something went wrong.
@ShinyDialga Is there any reason in particular why you decided to define all of these things statically?