-
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
PseudoDistant
committed
Dec 28, 2023
1 parent
9a6fa82
commit 3d751be
Showing
8 changed files
with
212 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
minicraftplus_version=2.2.0-local | ||
loader_version=0.15.3 | ||
|
||
# Mod Properties | ||
mod_version = 1.2.0 | ||
mod_version = 1.2.0-delux | ||
maven_group = io.github.minifabric | ||
archives_base_name = minifabric-modmenu | ||
|
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
28 changes: 28 additions & 0 deletions
28
src/main/java/io/github/minifabric/minifabric_api/impl/SingleModDisplay.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,28 @@ | ||
package io.github.minifabric.minifabric_api.impl; | ||
|
||
import com.mojang.ld22.screen.controlmenu.ControlMenu; | ||
import com.mojang.ld22.screen.controlmenu.TextControlMenu; | ||
import com.mojang.ld22.gfx.Color; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class SingleModDisplay extends TextControlMenu { | ||
public SingleModDisplay(ControlMenu parent, String mod_name, String content, String version) { | ||
super(parent); | ||
this.title = mod_name; | ||
List matchList = new ArrayList(); | ||
Pattern regex = Pattern.compile("(.{1,24}(?:\\s|$))|(.{0,10})", Pattern.DOTALL); | ||
Matcher regexMatcher = regex.matcher(content); | ||
while (regexMatcher.find()) { | ||
matchList.add(regexMatcher.group()); | ||
} | ||
matchList.forEach(phrase -> { | ||
this.addTextLine((String) phrase, Color.get(0, 333, 333, 333)); | ||
}); | ||
|
||
this.addTextLine(version, Color.get(0, 50, 50, 50)); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/java/io/github/minifabric/minifabric_api/mixin/MenuAccessor.java
This file was deleted.
Oops, something went wrong.
107 changes: 63 additions & 44 deletions
107
src/main/java/io/github/minifabric/minifabric_api/mixin/TitleDisplayMixin.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 |
---|---|---|
@@ -1,54 +1,73 @@ | ||
package io.github.minifabric.minifabric_api.mixin; | ||
|
||
import com.mojang.ld22.GameState; | ||
import com.mojang.ld22.screen.controlmenu.*; | ||
import com.mojang.ld22.sound.Sound; | ||
import io.github.minifabric.minifabric_api.impl.ModsDisplay; | ||
import minicraft.core.Game; | ||
import minicraft.gfx.Color; | ||
import minicraft.gfx.Point; | ||
import minicraft.gfx.Screen; | ||
import minicraft.screen.*; | ||
import minicraft.screen.entry.BlankEntry; | ||
import minicraft.screen.entry.ListEntry; | ||
import minicraft.screen.entry.SelectEntry; | ||
import minicraft.screen.entry.StringEntry; | ||
import minicraft.util.BookData; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.apache.commons.lang3.ArrayUtils; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(TitleDisplay.class) | ||
public class TitleDisplayMixin extends Display { | ||
@ModifyArg(method = "<init>", at = @At(value = "INVOKE", target = "Lminicraft/screen/Display;<init>(ZZ[Lminicraft/screen/Menu;)V"), index = 2) | ||
private static Menu[] yes(Menu[] menus) { | ||
return new Menu[]{(new Menu.Builder(false, 2, RelPos.CENTER, new ListEntry[]{new StringEntry("minicraft.displays.title.display.checking", Color.BLUE), new BlankEntry(), new SelectEntry("minicraft.displays.title.play", () -> { | ||
if (WorldSelectDisplay.getWorldNames().size() > 0) { | ||
Game.setDisplay(new Display(true, new Menu[]{(new Menu.Builder(false, 2, RelPos.CENTER, new ListEntry[]{new SelectEntry("minicraft.displays.title.play.load_world", () -> { | ||
Game.setDisplay(new WorldSelectDisplay()); | ||
}), new SelectEntry("minicraft.displays.title.play.new_world", () -> { | ||
Game.setDisplay(new WorldGenDisplay()); | ||
})})).createMenu()})); | ||
} else { | ||
Game.setDisplay(new WorldGenDisplay()); | ||
} | ||
|
||
}), new SelectEntry("minicraft.display.options_display", () -> { | ||
Game.setDisplay(new OptionsMainMenuDisplay()); | ||
}), new SelectEntry("Mods", () -> Game.setDisplay(new ModsDisplay())), | ||
new SelectEntry("minicraft.displays.skin", () -> { | ||
Game.setDisplay(new SkinDisplay()); | ||
}), new SelectEntry("minicraft.displays.achievements", () -> { | ||
Game.setDisplay(new AchievementsDisplay()); | ||
}), new SelectEntry("minicraft.displays.title.help", () -> { | ||
Game.setDisplay(new Display(true, new Menu[]{(new Menu.Builder(false, 1, RelPos.CENTER, new ListEntry[]{new BlankEntry(), new SelectEntry("minicraft.displays.title.help.instructions", () -> { | ||
Game.setDisplay(new BookDisplay(BookData.instructions.collect())); | ||
}), new SelectEntry("minicraft.displays.title.help.storyline_guide", () -> { | ||
Game.setDisplay(new BookDisplay(BookData.storylineGuide.collect())); | ||
}), new SelectEntry("minicraft.displays.title.help.about", () -> { | ||
Game.setDisplay(new BookDisplay(BookData.about.collect())); | ||
}), new SelectEntry("minicraft.displays.title.help.credits", () -> { | ||
Game.setDisplay(new BookDisplay(BookData.credits.collect())); | ||
})})).setTitle("minicraft.displays.title.help").createMenu()})); | ||
}), new SelectEntry("minicraft.displays.title.quit", Game::quit)})).setPositioning(new Point(Screen.w / 2, Screen.h * 3 / 5), RelPos.CENTER).createMenu()}; | ||
@Mixin(TitleMenu.class) | ||
public class TitleDisplayMixin extends SelectControlMenu { | ||
@Final @Mutable @Shadow private static String[] defaultOptions; | ||
|
||
public TitleDisplayMixin(ControlMenu parent) { | ||
super(parent); | ||
} | ||
|
||
/** | ||
* @author PseudoDistant | ||
* @reason Fuck it, not like anyone else would edit this. | ||
*/ | ||
@Overwrite | ||
public void optionSelected(int selected) { | ||
if (selected == 8) { | ||
this.gameControl.gameState.respawn(); | ||
this.gameControl.setMenu((ControlMenu)null); | ||
} | ||
|
||
if (selected == 7) { | ||
this.gameControl.setMenu((ControlMenu)null); | ||
} | ||
|
||
if (selected == 6) { | ||
Sound.test.play(); | ||
this.gameControl.gameState = new GameState(this.gameControl); | ||
this.gameControl.gameState.resetGame(); | ||
this.gameControl.setMenu((ControlMenu)null); | ||
} | ||
|
||
if (selected == 5) { | ||
this.gameControl.setMenu(new SaveMenu(this)); | ||
} | ||
|
||
if (selected == 4) { | ||
this.gameControl.setMenu(new LoadMenu(this)); | ||
} | ||
|
||
if (selected == 3) { | ||
this.gameControl.setMenu(new HighScoreMenu(this)); | ||
} | ||
|
||
if (selected == 2) { | ||
this.gameControl.setMenu(new InstructionsMenu(this)); | ||
} | ||
|
||
if (selected == 1) { | ||
this.gameControl.setMenu(new AboutMenu(this)); | ||
} | ||
|
||
if (selected == 0) { | ||
this.gameControl.setMenu(new ModsDisplay(this)); | ||
} | ||
|
||
} | ||
|
||
static { | ||
defaultOptions = ArrayUtils.add(defaultOptions,0, "Mods"); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -21,8 +21,8 @@ | |
"modmenu.mixins.json" | ||
], | ||
"depends": { | ||
"minicraftplus": [ | ||
"2.2.0-dev3" | ||
"minicraft-delux": [ | ||
"1.20" | ||
] | ||
} | ||
} |
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