-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d224c6
commit 1f40521
Showing
14 changed files
with
546 additions
and
7 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
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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/net/plastoid501/movement/config/Configs.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,35 @@ | ||
package net.plastoid501.movement.config; | ||
|
||
import net.plastoid501.movement.config.json.JToggleConfig; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class Configs { | ||
public static Map<String, ToggleConfig> toggles = new LinkedHashMap<>(); | ||
public static Map<String, JToggleConfig> jToggles = new LinkedHashMap<>(); | ||
|
||
public static ToggleConfig modEnable = new ToggleConfig("modEnable", "If true, this mod is enable", true); | ||
public static ToggleConfig inCreative = new ToggleConfig("inCreative", "If true, this mod is enable when creative mode.", true); | ||
|
||
public static ModConfig config; | ||
|
||
static { | ||
toggles.put(modEnable.getId(), modEnable); | ||
toggles.put(inCreative.getId(), inCreative); | ||
jToggles.put(modEnable.getId(), new JToggleConfig(modEnable.isEnable())); | ||
jToggles.put(inCreative.getId(), new JToggleConfig(inCreative.isEnable())); | ||
|
||
config = new ModConfig(jToggles); | ||
|
||
} | ||
|
||
|
||
public static Map<String, ToggleConfig> getToggles() { | ||
return toggles; | ||
} | ||
|
||
public static Map<String, JToggleConfig> getJToggles() { | ||
return jToggles; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/net/plastoid501/movement/config/ModConfig.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,22 @@ | ||
package net.plastoid501.movement.config; | ||
|
||
import net.plastoid501.movement.config.json.JToggleConfig; | ||
|
||
import java.util.Map; | ||
|
||
public class ModConfig { | ||
private Map<String, JToggleConfig> Toggles; | ||
|
||
public ModConfig(Map<String, JToggleConfig> Toggles) { | ||
this.Toggles = Toggles; | ||
} | ||
|
||
public Map<String, JToggleConfig> getToggles() { | ||
return Toggles; | ||
} | ||
|
||
public void setToggles(Map<String, JToggleConfig> toggles) { | ||
Toggles = toggles; | ||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
src/main/java/net/plastoid501/movement/config/ToggleConfig.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,30 @@ | ||
package net.plastoid501.movement.config; | ||
|
||
import net.plastoid501.movement.config.json.JToggleConfig; | ||
|
||
public class ToggleConfig extends JToggleConfig { | ||
private String id; | ||
private String narrator; | ||
|
||
public ToggleConfig(String id, String narrator, Boolean enable) { | ||
super(enable); | ||
this.id = id; | ||
this.narrator = narrator; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getNarrator() { | ||
return narrator; | ||
} | ||
|
||
public void setNarrator(String narrator) { | ||
this.narrator = narrator; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/net/plastoid501/movement/config/json/JToggleConfig.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,17 @@ | ||
package net.plastoid501.movement.config.json; | ||
|
||
public class JToggleConfig { | ||
private boolean enable; | ||
|
||
public JToggleConfig(boolean enable) { | ||
this.enable = enable; | ||
} | ||
|
||
public boolean isEnable() { | ||
return enable; | ||
} | ||
|
||
public void setEnable(boolean enable) { | ||
this.enable = enable; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/net/plastoid501/movement/gui/ConfigScreen.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,57 @@ | ||
package net.plastoid501.movement.gui; | ||
|
||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.screen.ScreenTexts; | ||
import net.minecraft.text.Text; | ||
import net.plastoid501.movement.gui.widget.ConfigWidget; | ||
|
||
public class ConfigScreen extends Screen { | ||
private ConfigWidget configList; | ||
private final Screen parent; | ||
|
||
public ConfigScreen(Screen parent) { | ||
super(Text.literal("Movement In GUI")); | ||
this.parent = parent; | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
this.configList = new ConfigWidget(this, this.client); | ||
this.addSelectableChild(this.configList); | ||
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> { | ||
this.close(); | ||
}).dimensions(this.width / 2 - 100, this.height - 27, 200, 20).build()); | ||
} | ||
|
||
@Override | ||
public void render(DrawContext context, int mouseX, int mouseY, float delta) { | ||
super.render(context, mouseX, mouseY, delta); | ||
this.configList.render(context, mouseX, mouseY, delta); | ||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 8, 0xFFFFFF); | ||
} | ||
|
||
@Override | ||
public boolean shouldPause() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void close() { | ||
if (this.client != null) { | ||
this.client.setScreen(this.parent); | ||
} | ||
} | ||
|
||
/* | ||
@Override | ||
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { | ||
if (this.client == null || this.client.player == null || this.client.world == null) { | ||
this.renderBackgroundTexture(context); | ||
} | ||
} | ||
*/ | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/net/plastoid501/movement/gui/ModMenuIntegration.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,13 @@ | ||
package net.plastoid501.movement.gui; | ||
|
||
import com.terraformersmc.modmenu.api.ConfigScreenFactory; | ||
import com.terraformersmc.modmenu.api.ModMenuApi; | ||
import net.plastoid501.movement.util.FileUtil; | ||
|
||
public class ModMenuIntegration implements ModMenuApi { | ||
@Override | ||
public ConfigScreenFactory<?> getModConfigScreenFactory() { | ||
FileUtil.updateConfigs(); | ||
return ConfigScreen::new; | ||
} | ||
} |
Oops, something went wrong.