66 lines
1.5 KiB
Java
66 lines
1.5 KiB
Java
package pm.j4.petroleum.modules.menu;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import net.minecraft.client.MinecraftClient;
|
|
import pm.j4.petroleum.gui.PModMenuScreen;
|
|
import pm.j4.petroleum.util.data.Category;
|
|
import pm.j4.petroleum.util.module.ModuleBase;
|
|
import pm.j4.petroleum.util.config.ConfigManager;
|
|
import pm.j4.petroleum.util.data.Coordinate;
|
|
|
|
/**
|
|
* The type Mod menu.
|
|
*/
|
|
public class ModMenu extends ModuleBase {
|
|
|
|
private static Map<String, Coordinate> coordinates = new HashMap<>();
|
|
|
|
/**
|
|
* Instantiates a new Mod menu.
|
|
*/
|
|
public ModMenu() {
|
|
super("petroleum.modmenu",
|
|
"petroleum.misc",
|
|
true,
|
|
true,
|
|
true);
|
|
}
|
|
|
|
@Override
|
|
public void init() {
|
|
Map<String, List<ModuleBase>> categories = Category.getCategoryMap();
|
|
final double[] h = {.1};
|
|
categories.forEach((category, moduleList) -> {
|
|
System.out.println("category: " + category);
|
|
Coordinate coord = new Coordinate(.1, h[0]);
|
|
h[0] += .01;
|
|
coordinates.put(category, coord);
|
|
});
|
|
}
|
|
|
|
public static void updateCoord(String b, Coordinate c) {
|
|
if (coordinates.containsKey(b)) {
|
|
coordinates.replace(b, c);
|
|
}
|
|
else {
|
|
System.out.println("issue! no matching coordinate found");
|
|
System.out.println(b);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void activate(MinecraftClient client) {
|
|
this.toggle();
|
|
if (ConfigManager.getConfig().get().isModuleEnabled(this.getModuleName())) {
|
|
client.openScreen(new PModMenuScreen());
|
|
} else {
|
|
client.openScreen(null);
|
|
}
|
|
}
|
|
|
|
public static Map<String, Coordinate> getButtons() {
|
|
return coordinates;
|
|
}
|
|
} |