Skip to content

Commit

Permalink
Updat to 2.2.0-dev3
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoDistant committed Dec 28, 2023
1 parent adeca27 commit 9a6fa82
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 65 deletions.
13 changes: 3 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@ repositories {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'RewovenMC'
url = 'https://maven.rewovenmc.tk/'
}
maven {
name = 'MinicraftPlus'
url = 'https://repo.repsy.io/mvn/minicraftplus/minicraft'
}
mavenCentral()
mavenLocal()
}

dependencies {
implementation "java.minicraft:minicraft-plus-revived:${project.minicraftplus_version}"
implementation 'io.github.pseudodistant:MinicraftGameProvider:1.1.1'
implementation("java.minicraft:minicraft-plus:${project.minicraftplus_version}")
implementation 'io.github.pseudodistant:MinicraftGameProvider:1.2.0'
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc:sponge-mixin:0.11.0+mixin.0.8.5"
implementation "net.fabricmc:access-widener:2.1.0"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
org.gradle.jvmargs=-Xmx1G

minicraftplus_version=2.1.0-dev2
loader_version=0.13.0
minicraftplus_version=2.2.0-local
loader_version=0.15.3

# Mod Properties
mod_version = 1.0.0
mod_version = 1.2.0
maven_group = io.github.minifabric
archives_base_name = minifabric-modmenu

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.github.minifabric.minifabric_api.impl;

public interface MenuDuck {
int selectionGetter();
int minifabric_modmenu$selectionGetter();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.minifabric.minifabric_api.impl;

import minicraft.core.Action;
import minicraft.core.Game;
import minicraft.core.io.InputHandler;
import minicraft.core.io.Localization;
Expand All @@ -12,7 +11,6 @@
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;

import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
Expand Down Expand Up @@ -74,7 +72,7 @@ public ModsDisplay() {
public void tick(InputHandler input) {
super.tick(input);
if (input.getKey("exit").clicked) {
Game.setMenu(parent);
Game.setDisplay(parent);
}
}

Expand All @@ -90,10 +88,16 @@ public void init(Display parent) {
for(int i = 0; i < entries.length; i++) {
String name = modNames.get(i);
final String version = modVersions.get(i);
String description = modsList.stream().filter(mod -> Objects.equals(mod.getMetadata().getName(), name)).findFirst().get().getMetadata().getDescription() == null ?
"" : modsList.stream().filter(mod -> Objects.equals(mod.getMetadata().getName(), name)).findFirst().get().getMetadata().getDescription();
String description = modsList.stream()
.filter(mod -> Objects.equals(mod.getMetadata().getName(), name))
.findFirst().get().getMetadata().getDescription() == null ?
"" : modsList.stream()
.filter(mod -> Objects.equals(mod.getMetadata().getName(), name))
.findFirst().get().getMetadata().getDescription();


entries[i] = new SelectEntry(modNames.get(i), () -> {
Game.setMenu(new BookDisplay(description, false));
Game.setDisplay(new BookDisplay(description, false));
}, false) {};
}

Expand All @@ -111,7 +115,7 @@ public void init(Display parent) {
public void render(Screen screen) {
super.render(screen);

int sel = ((MenuDuck)menus[0]).selectionGetter();
int sel = ((MenuDuck)menus[0]).minifabric_modmenu$selectionGetter();
if(sel >= 0 && sel < modVersions.size()) {
String name = modNames.get(sel);
String version = modVersions.get(sel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class MenuAccessor implements MenuDuck {
@Shadow private int selection;

public int selectionGetter() {
public int minifabric_modmenu$selectionGetter() {
return selection;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,47 @@
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 net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

import java.util.ArrayList;
import java.util.Collection;

@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"))
@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 StringEntry("Checking for updates...", Color.BLUE),
new BlankEntry(),
new BlankEntry(),
new SelectEntry("Play", () -> /*Game.setMenu(new PlayDisplay())*/{
if (WorldSelectDisplay.getWorldNames().size() > 0)
Game.setMenu(new Display(true, new Menu.Builder(false, 2, RelPos.CENTER,
new SelectEntry("Load World", () -> Game.setMenu(new WorldSelectDisplay())),
new SelectEntry("New World", () -> Game.setMenu(new WorldGenDisplay()))
).createMenu()));
else Game.setMenu(new WorldGenDisplay());
}),
new SelectEntry("Options", () -> Game.setMenu(new OptionsMainMenuDisplay())),
new SelectEntry("Mods", () -> Game.setMenu(new ModsDisplay())),
new SelectEntry("Skins", () -> Game.setMenu(new SkinDisplay())),
new SelectEntry("Achievements", () -> Game.setMenu(new AchievementsDisplay())),
new SelectEntry("Help", () ->
Game.setMenu(new Display(true, new Menu.Builder(false, 1, RelPos.CENTER,
new BlankEntry(),
new SelectEntry("Instructions", () -> Game.setMenu(new BookDisplay(BookData.instructions))),
new SelectEntry("Storyline Guide", () -> Game.setMenu(new BookDisplay(BookData.storylineGuide))),
new SelectEntry("About", () -> Game.setMenu(new BookDisplay(BookData.about))),
new SelectEntry("Credits", () -> Game.setMenu(new BookDisplay(BookData.credits)))
).setTitle("Help").createMenu()))
),
new SelectEntry("Quit", Game::quit)
)
.setPositioning(new Point(Screen.w / 2, Screen.h * 3 / 5), RelPos.CENTER)
.createMenu()};
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()};
}


Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"schemaVersion": 1,
"id": "minifabric-mod-menu",
"name": "MiniFabric Mod Menu",
"description": "MiniFabric ModMenu, to display and configure mods!",
"version": "${version}",
"environment": "*",
"license": "Apache-2.0",
Expand All @@ -17,10 +18,11 @@
"PseudoDistant"
],
"mixins": [
"modid.mixins.json"
"modmenu.mixins.json"
],
"depends": {
"minicraftplus": "2.1.0-dev1"
},
"description": "MiniFabric Mod Menu"
"minicraftplus": [
"2.2.0-dev3"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"package": "io.github.minifabric.minifabric_api.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [

],
"client": [
"TitleDisplayMixin",
"MenuAccessor"
],
"client": [

],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 9a6fa82

Please sign in to comment.