just a copy of petroleum right now
This commit is contained in:
commit
183c81258a
88 changed files with 7405 additions and 0 deletions
37
remappedSrc/pm/j4/petroleum/modules/ExampleModule.java
Normal file
37
remappedSrc/pm/j4/petroleum/modules/ExampleModule.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package pm.j4.petroleum.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
import pm.j4.petroleum.util.module.option.BooleanOption;
|
||||
import pm.j4.petroleum.util.module.option.ConfigurationOption;
|
||||
|
||||
/**
|
||||
* The type Example module.
|
||||
*/
|
||||
public class ExampleModule extends ModuleBase {
|
||||
/**
|
||||
* example mod
|
||||
*/
|
||||
public ExampleModule() {
|
||||
super("petroleum.example",
|
||||
"petroleum.misc",
|
||||
true,
|
||||
false,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, ConfigurationOption> getDefaultConfig() {
|
||||
Map<String, ConfigurationOption> options = new HashMap<>();
|
||||
options.put("petroleum.example_b_one", new BooleanOption("example"));
|
||||
options.put("petroleum.example_b_two", new BooleanOption("example"));
|
||||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(MinecraftClient client) {
|
||||
System.out.println("Example Mod Keybind Activate");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package pm.j4.petroleum.modules.bindings;
|
||||
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
|
||||
/**
|
||||
* The type Binding info.
|
||||
*/
|
||||
public class BindingInfo {
|
||||
/**
|
||||
* The Translation key.
|
||||
*/
|
||||
public String translationKey;
|
||||
/**
|
||||
* The Type.
|
||||
*/
|
||||
public InputUtil.Type type;
|
||||
/**
|
||||
* The Key.
|
||||
*/
|
||||
public int key;
|
||||
/**
|
||||
* The Category.
|
||||
*/
|
||||
public String category;
|
||||
|
||||
/**
|
||||
* The Attached function id.
|
||||
*/
|
||||
public String attachedModuleName;
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package pm.j4.petroleum.modules.bindings;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import pm.j4.petroleum.PetroleumMod;
|
||||
import pm.j4.petroleum.gui.PModuleConfigEntry;
|
||||
import pm.j4.petroleum.util.config.ConfigManager;
|
||||
import pm.j4.petroleum.util.config.GlobalConfig;
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
import pm.j4.petroleum.util.module.option.KeybindOption;
|
||||
|
||||
/**
|
||||
* The type Binding manager.
|
||||
*/
|
||||
public class BindingManager extends ModuleBase {
|
||||
/**
|
||||
* Instantiates a new Module base.
|
||||
* Parameters should be constant across restarts.
|
||||
*/
|
||||
public BindingManager() {
|
||||
super("petroleum.bindings",
|
||||
"petroleum.misc",
|
||||
false,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
registerBindings();
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PModuleConfigEntry> getConfigEntries() {
|
||||
List<PModuleConfigEntry> entries = new ArrayList<>();
|
||||
|
||||
Map<KeybindOption, ModuleBase> mapped = new HashMap<>();
|
||||
if (ConfigManager.getConfig().isPresent()) {
|
||||
Map<KeyBinding, ModuleBase> binds = ConfigManager.getConfig().get().globalConfig.bindings;
|
||||
|
||||
binds.forEach((key, func) -> {
|
||||
KeybindOption option = new KeybindOption(func.getModuleName() + " " + func.getCategory());
|
||||
option.fromKeybind(key, func);
|
||||
mapped.put(option, func);
|
||||
});
|
||||
}
|
||||
mapped.forEach((configEntry, module) -> {
|
||||
PModuleConfigEntry entry = new PModuleConfigEntry(configEntry, new TranslatableText(module.getModuleName())) {
|
||||
//TODO keybinding. most likely involves mixin to take direct key input
|
||||
// look into how keybinding in regular options screen works
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
if (this.displayText != null) {
|
||||
MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, displayText, x, y, 0xAAAAAA);
|
||||
}
|
||||
if (this.option != null) {
|
||||
int fontHeight = MinecraftClient.getInstance().textRenderer.fontHeight;
|
||||
MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, "Key Value: " + this.option.getStringValue(), x, y + fontHeight + 4, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
};
|
||||
entries.add(entry);
|
||||
});
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register bindings.
|
||||
*/
|
||||
private void registerBindings() {
|
||||
if (!ConfigManager.getConfig().isPresent()) {
|
||||
return;
|
||||
}
|
||||
GlobalConfig c = ConfigManager.getConfig().get().globalConfig;
|
||||
Optional<ModuleBase> mod = PetroleumMod.getMod("petroleum.modmenu");
|
||||
if (mod.isPresent() && !c.isBound(mod.get())) {
|
||||
//TODO
|
||||
// the only explicit keybinding (for now.)
|
||||
// once the binding manager has been completed,
|
||||
// this should be migrated there, as a default binding
|
||||
KeyBinding binding = new KeyBinding(
|
||||
"key.petroleum.togglemodmenu",
|
||||
InputUtil.Type.KEYSYM,
|
||||
GLFW.GLFW_KEY_RIGHT_CONTROL,
|
||||
"category.petroleum"
|
||||
);
|
||||
ConfigManager.getConfig().get().globalConfig.setBinding(binding, mod.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
44
remappedSrc/pm/j4/petroleum/modules/list/ModList.java
Normal file
44
remappedSrc/pm/j4/petroleum/modules/list/ModList.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package pm.j4.petroleum.modules.list;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import jdk.nashorn.internal.runtime.options.Option;
|
||||
import pm.j4.petroleum.PetroleumMod;
|
||||
import pm.j4.petroleum.util.config.ConfigHolder;
|
||||
import pm.j4.petroleum.util.config.ConfigManager;
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
|
||||
/**
|
||||
* The type Mod list.
|
||||
*/
|
||||
public class ModList extends ModuleBase {
|
||||
/**
|
||||
* Instantiates a new Mod list.
|
||||
*/
|
||||
public ModList() {
|
||||
super("petroleum.modlist",
|
||||
"petroleum.misc",
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets active.
|
||||
*
|
||||
* @return the active
|
||||
*/
|
||||
public static List<ModuleBase> getActive() {
|
||||
List<ModuleBase> result = new ArrayList<>();
|
||||
Optional<ConfigHolder> config = ConfigManager.getConfig();
|
||||
if(config.isPresent()) {
|
||||
config.get().getEnabledModules().forEach((mod) -> {
|
||||
if (!mod.isHidden()) {
|
||||
result.add(mod);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
98
remappedSrc/pm/j4/petroleum/modules/menu/ModMenu.java
Normal file
98
remappedSrc/pm/j4/petroleum/modules/menu/ModMenu.java
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
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.config.ConfigManager;
|
||||
import pm.j4.petroleum.util.data.ButtonInformation;
|
||||
import pm.j4.petroleum.util.data.Category;
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
|
||||
/**
|
||||
* The type Mod menu.
|
||||
*/
|
||||
public class ModMenu extends ModuleBase {
|
||||
|
||||
/**
|
||||
* The constant coordinates.
|
||||
*/
|
||||
private static final Map<String, ButtonInformation> coordinates = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Instantiates a new Mod menu.
|
||||
*/
|
||||
public ModMenu() {
|
||||
super("petroleum.modmenu",
|
||||
"petroleum.misc",
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
// TODO figure out resizing
|
||||
// the number itself changes, so it should just be probably like some onResize bullshit in PModMenuScreen
|
||||
@Override
|
||||
public void init() {
|
||||
Map<String, List<ModuleBase>> categories = Category.getCategoryMap();
|
||||
final double[] h = {.1};
|
||||
categories.forEach((category, moduleList) -> {
|
||||
ButtonInformation conf = ConfigManager.getConfig().isPresent() ?
|
||||
ConfigManager.getConfig().get().globalConfig.getButton(category) :
|
||||
null;
|
||||
ButtonInformation coord = conf != null ? conf : new ButtonInformation(.1, h[0], false);
|
||||
h[0] += .01;
|
||||
coordinates.put(category, coord);
|
||||
if (ConfigManager.getConfig().isPresent()) {
|
||||
ConfigManager.getConfig().get().globalConfig.setButton(category, coord);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update coord.
|
||||
*
|
||||
* @param b the b
|
||||
* @param c the c
|
||||
*/
|
||||
public static void updateCoord(String b, ButtonInformation c) {
|
||||
if (c.x < 0.05) {
|
||||
c.x = 0.05;
|
||||
}
|
||||
if (c.x > .95) {
|
||||
c.x = .95;
|
||||
}
|
||||
if (c.y < 0.05) {
|
||||
c.y = 0.05;
|
||||
}
|
||||
if (c.y > .95) {
|
||||
c.y = .95;
|
||||
}
|
||||
if (coordinates.containsKey(b)) {
|
||||
coordinates.replace(b, c);
|
||||
if (ConfigManager.getConfig().isPresent()) {
|
||||
ConfigManager.getConfig().get().globalConfig.setButton(b, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(MinecraftClient client) {
|
||||
this.toggle();
|
||||
if (ConfigManager.getConfig().get().isModuleEnabled(this.getModuleName())) {
|
||||
client.openScreen(new PModMenuScreen());
|
||||
} else {
|
||||
client.openScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets buttons.
|
||||
*
|
||||
* @return the buttons
|
||||
*/
|
||||
public static Map<String, ButtonInformation> getButtons() {
|
||||
return coordinates;
|
||||
}
|
||||
}
|
||||
56
remappedSrc/pm/j4/petroleum/modules/splash/SplashText.java
Normal file
56
remappedSrc/pm/j4/petroleum/modules/splash/SplashText.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package pm.j4.petroleum.modules.splash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import pm.j4.petroleum.PetroleumMod;
|
||||
import pm.j4.petroleum.gui.PModuleConfigEntry;
|
||||
import pm.j4.petroleum.util.config.ConfigManager;
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
import pm.j4.petroleum.util.module.option.BooleanOption;
|
||||
import pm.j4.petroleum.util.module.option.ConfigurationOption;
|
||||
import pm.j4.petroleum.util.module.option.KeybindOption;
|
||||
|
||||
/**
|
||||
* The type Splash text.
|
||||
*/
|
||||
public class SplashText extends ModuleBase {
|
||||
/**
|
||||
* Instantiates a new Splash text.
|
||||
*/
|
||||
public SplashText() {
|
||||
super("petroleum.splashtext",
|
||||
"petroleum.misc",
|
||||
false,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PModuleConfigEntry> getConfigEntries() {
|
||||
List<PModuleConfigEntry> entries = new ArrayList<>();
|
||||
ConfigurationOption activeToggle = new BooleanOption("Show the main menu version text:");
|
||||
PModuleConfigEntry activeEntry = new PModuleConfigEntry(activeToggle, new LiteralText("Active"));
|
||||
entries.add(activeEntry);
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public static String get() {
|
||||
if (PetroleumMod.modData != null) {
|
||||
return "Petroleum v" + PetroleumMod.modData.getVersion().getFriendlyString();
|
||||
}
|
||||
return "Petroleum vUnknown";
|
||||
}
|
||||
}
|
||||
19
remappedSrc/pm/j4/petroleum/modules/xray/Xray.java
Normal file
19
remappedSrc/pm/j4/petroleum/modules/xray/Xray.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package pm.j4.petroleum.modules.xray;
|
||||
|
||||
import pm.j4.petroleum.util.module.ModuleBase;
|
||||
|
||||
/**
|
||||
* The type Xray.
|
||||
*/
|
||||
public class Xray extends ModuleBase {
|
||||
/**
|
||||
* Instantiates a new Xray.
|
||||
*/
|
||||
public Xray() {
|
||||
super("petroleum.xray",
|
||||
"petroleum.render",
|
||||
true,
|
||||
false,
|
||||
true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue