Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added option to enable/disable mods to the audio/video menu

  • Loading branch information...
commit 3346547a4e1b58f7a15abef1b30d53f13e2f736f 1 parent ba20649
@Flet Flet authored
View
1  res/translations/texts.txt
@@ -119,6 +119,7 @@ options.alternative = ALTERNATIVE PLAYER SKIN
options.credits = CREDITS
options.openal = Sound system OpenAL
options.smallscale = SMALL GRAPHICS
+options.enableMods = ENABLE MODS (RESTART REQUIRED)
pausemenu.help = HELP
pausemenu.backtomain = MAIN
View
1  src/com/mojang/mojam/Options.java
@@ -35,6 +35,7 @@
public static final String DLSYSTEM = "dlsystem";
public static final String DLBUFFERSIZE = "dlbuffer";
+ public static final String ENABLE_MODS = "enableMods";
private static Properties properties = new Properties();
View
22 src/com/mojang/mojam/gui/AudioVideoMenu.java
@@ -22,6 +22,7 @@
private boolean opengl;
private boolean trapMouse;
private boolean fps;
+ private boolean enableMods;
private float musicVolume;
private float soundsVolume;
private float volume;
@@ -38,6 +39,7 @@
private ClickableComponent openGlBtn;
private ClickableComponent trapMouseBtn;
private ClickableComponent fpsBtn;
+ private ClickableComponent enableModsBtn;
private ClickableComponent soundVol;
private ClickableComponent musicVol;
private ClickableComponent soundsVol;
@@ -53,7 +55,7 @@ public AudioVideoMenu(boolean inGame) {
gameHeight = MojamComponent.GAME_HEIGHT;
int offset = 32;
int xOffset = (gameWidth - Button.BUTTON_WIDTH) / 2;
- int yOffset = (gameHeight - (9 * offset + 20 + (offset * 2))) / 2;
+ int yOffset = (gameHeight - (11 * offset + 20 + (offset * 2))) / 2;
textY = yOffset;
yOffset += offset;
@@ -89,6 +91,12 @@ public AudioVideoMenu(boolean inGame) {
yOffset += offset, Options.getAsBoolean(Options.DRAW_FPS,
Options.VALUE_FALSE))
);
+ enableModsBtn = addButton(
+ new Checkbox(TitleMenu.FPS_ID,
+ MojamComponent.texts.getStatic("options.enableMods"), xOffset,
+ yOffset += offset, Options.getAsBoolean(Options.ENABLE_MODS,
+ Options.VALUE_FALSE))
+ );
soundOpenALBtn = addButton(
new Checkbox(TitleMenu.OPEN_AL_ID,
MojamComponent.texts.getStatic("options.openal"), xOffset,
@@ -181,6 +189,17 @@ public void buttonPressed(ClickableComponent button) {
public void buttonHovered(ClickableComponent clickableComponent) {
}
});
+ enableModsBtn.addListener(new ButtonListener() {
+ @Override
+ public void buttonPressed(ClickableComponent button) {
+ enableMods = !enableMods;
+ Options.set(Options.ENABLE_MODS, enableMods);
+ }
+
+ @Override
+ public void buttonHovered(ClickableComponent clickableComponent) {
+ }
+ });
soundVol.addListener(new ButtonListener() {
@Override
public void buttonPressed(ClickableComponent button) {
@@ -253,6 +272,7 @@ private void loadOptions() {
trapMouse = Options.getAsBoolean(Options.TRAP_MOUSE, Options.VALUE_FALSE);
opengl = Options.getAsBoolean(Options.OPENGL, Options.VALUE_FALSE);
fps = Options.getAsBoolean(Options.DRAW_FPS, Options.VALUE_FALSE);
+ enableMods = Options.getAsBoolean(Options.ENABLE_MODS, Options.VALUE_FALSE);
openAL = Options.getAsBoolean(Options.OPEN_AL, Options.VALUE_TRUE);
musicVolume = Options.getAsFloat(Options.MUSIC, "1.0f");
soundsVolume = Options.getAsFloat(Options.SOUND, "1.0f");
View
3  src/com/mojang/mojam/mod/Mod.java
@@ -1,8 +1,7 @@
package com.mojang.mojam.mod;
-import com.mojang.mojam.Keys;
-import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.Keys.Key;
+import com.mojang.mojam.MojamComponent;
import com.mojang.mojam.entity.Entity;
import com.mojang.mojam.entity.building.SpawnerEntity;
import com.mojang.mojam.entity.mob.Team;
View
24 src/com/mojang/mojam/mod/ModSystem.java
@@ -120,15 +120,25 @@ public static void init(MojamComponent m) {
e1.printStackTrace();
}
- System.out.println("ModSystem starting up...");
- addMod(ModSystem.class.getClassLoader(), "SnatchContent.class");
inputHandler = (InputHandler) reflectField(mojam, "inputHandler");
- try {
- readLinksFromFile(new File(mojam.getMojamDir(), "mods.txt"));
- readFromClassPath(modDir);
- } catch (Exception e) {
- e.printStackTrace();
+
+
+
+ addMod(ModSystem.class.getClassLoader(), "SnatchContent.class");
+
+
+ if (Options.getAsBoolean(Options.ENABLE_MODS, Options.VALUE_FALSE)) {
+ System.out.println("ModSystem starting up...");
+ try {
+ readLinksFromFile(new File(mojam.getMojamDir(), "mods.txt"));
+ readFromClassPath(modDir);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ System.out.println("ModSystem disabled...");
}
+
}
/**
View
1  src/com/mojang/mojam/mod/mod_TestSpawners.java
@@ -1,6 +1,5 @@
package com.mojang.mojam.mod;
-import com.mojang.mojam.Keys;
import com.mojang.mojam.Keys.Key;
import com.mojang.mojam.entity.Entity;
import com.mojang.mojam.entity.mob.Mob;
Please sign in to comment.
Something went wrong with that request. Please try again.