From ae2ea9373b8b7cdd1530062d0a42b615f9b94ce3 Mon Sep 17 00:00:00 2001 From: DJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com> Date: Thu, 15 Jul 2021 20:40:07 -0400 Subject: Update to Essential --- build.gradle | 50 +- gradle/wrapper/gradle-wrapper.properties | 2 +- libs/modcore.jar | Bin 9776522 -> 0 bytes .../perspectivemod/ModCoreInstaller.java | 506 --------------------- .../perspectivemod/PerspectiveMod.java | 7 +- .../transformers/EntityRendererTransformer.java | 2 - .../asm/transformers/MinecraftTransformer.java | 3 +- .../asm/transformers/RenderManagerTransformer.java | 1 - .../commands/PerspectiveModCommand.java | 59 +-- .../config/PerspectiveModConfig.java | 6 +- .../forge/PerspectiveModTweaker.java | 12 - 11 files changed, 62 insertions(+), 586 deletions(-) delete mode 100644 libs/modcore.jar delete mode 100644 src/main/java/me/djtheredstoner/perspectivemod/ModCoreInstaller.java diff --git a/build.gradle b/build.gradle index c5b0b3d..17861cc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,24 @@ buildscript { repositories { - jcenter() + mavenCentral() + gradlePluginPortal() maven { name = "forge" - url = "https://files.minecraftforge.net/maven" + url = "https://maven.minecraftforge.net/" + } + maven { + name = "jitpack" + url = "https://jitpack.io/" } - - flatDir dirs: 'libs' } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT" + classpath "com.github.asbyth:ForgeGradle:b13624b272" + classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0" } } apply plugin: "net.minecraftforge.gradle.forge" +apply plugin: "com.github.johnrengelman.shadow" group= "me.djtheredstoner" @@ -34,21 +39,52 @@ minecraft { clientJvmArgs += "-Dfml.coreMods.load=me.djtheredstoner.perspectivemod.forge.PerspectiveModTweaker" } +configurations { + embed + implementation.extendsFrom(embed) +} + +repositories { + mavenCentral() + maven { url = "https://repo.sk1er.club/repository/maven-public/" } + maven { url = "https://jitpack.io/" } + maven { url = "https://repo.spongepowered.org/repository/maven-public/" } +} + dependencies { - provided files("libs/modcore.jar") + embed "gg.essential:loader-launchwrapper:1.0.2" + + implementation "gg.essential:Essential:1193-10809-SNAPSHOT" } jar { + enabled = false +} + +shadowJar { + archiveClassifier.set("") + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + configurations = [project.configurations.embed] + manifest.attributes( 'FMLCorePluginContainsFMLMod': true, "ForceLoadAsMod": true, 'ModSide': 'CLIENT', - "FMLCorePlugin": "me.djtheredstoner.perspectivemod.forge.PerspectiveModTweaker" + "FMLCorePlugin": "me.djtheredstoner.perspectivemod.forge.PerspectiveModTweaker", + "TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker" ) } +reobfJar.dependsOn tasks.shadowJar + +reobf { + shadowJar { + mappingType = 'SEARGE' + } +} + processResources { // this will ensure that this task is redone when the versions change. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae45383..8cf6eb5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/libs/modcore.jar b/libs/modcore.jar deleted file mode 100644 index c1e7436..0000000 Binary files a/libs/modcore.jar and /dev/null differ diff --git a/src/main/java/me/djtheredstoner/perspectivemod/ModCoreInstaller.java b/src/main/java/me/djtheredstoner/perspectivemod/ModCoreInstaller.java deleted file mode 100644 index cda3837..0000000 --- a/src/main/java/me/djtheredstoner/perspectivemod/ModCoreInstaller.java +++ /dev/null @@ -1,506 +0,0 @@ -package me.djtheredstoner.perspectivemod; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import net.minecraft.launchwrapper.Launch; -import net.minecraft.launchwrapper.LaunchClassLoader; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; - -import javax.swing.GroupLayout; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JProgressBar; -import javax.swing.LayoutStyle; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import java.awt.Font; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.HttpURLConnection; -import java.net.URL; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/* - Created by Sk1er for use in all mods. Install under exact package name each time. - */ -public class ModCoreInstaller { - - - private static final String VERSION_URL = "https://api.sk1er.club/modcore_versions"; - private static final String className = "club.sk1er.mods.core.ModCore"; - private static boolean errored = false; - private static String error; - private static File dataDir = null; - private static boolean isRunningModCore = false; - - public static boolean isIsRunningModCore() { - return isRunningModCore; - } - - private static boolean isInitalized() { - try { - LinkedHashSet objects = new LinkedHashSet<>(); - objects.add(className); - Launch.classLoader.clearNegativeEntries(objects); - Field invalidClasses = LaunchClassLoader.class.getDeclaredField("invalidClasses"); - invalidClasses.setAccessible(true); - Object obj = invalidClasses.get(ModCoreInstaller.class.getClassLoader()); - ((Set) obj).remove(className); - return Class.forName("club.sk1er.mods.core.ModCore") != null; - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException ignored) { - ignored.printStackTrace(); - } - return false; - } - - public static boolean isErrored() { - return errored; - } - - public static String getError() { - return error; - } - - private static void bail(String error) { - errored = true; - ModCoreInstaller.error = error; - } - - private static JsonHolder readFile(File in) { - try { - return new JsonHolder(FileUtils.readFileToString(in)); - } catch (IOException ignored) { - - } - return new JsonHolder(); - } - - public static void initializeModCore(File gameDir) { - if (!isIsRunningModCore()) { - return; - } - try { - Class modCore = Class.forName(className); - Method instanceMethod = modCore.getMethod("getInstance"); - Method initialize = modCore.getMethod("initialize", File.class); - Object modCoreObject = instanceMethod.invoke(null); - initialize.invoke(modCoreObject, gameDir); - System.out.println("Loaded ModCore Successfully"); - return; - } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - } - System.out.println("Did NOT ModCore Successfully"); - } - - public static int initialize(File gameDir, String minecraftVersion) { - if (isInitalized()) return -1; - dataDir = new File(gameDir, "modcore"); - if (!dataDir.exists()) { - if (!dataDir.mkdirs()) { - bail("Unable to create necessary files"); - return 1; - } - } - JsonHolder jsonHolder = fetchJSON(VERSION_URL); - String latestRemote = jsonHolder.optString(minecraftVersion); - boolean failed = jsonHolder.getKeys().size() == 0 || (jsonHolder.has("success") && !jsonHolder.optBoolean("success")); - - File metadataFile = new File(dataDir, "metadata.json"); - JsonHolder localMetadata = readFile(metadataFile); - if (failed) latestRemote = localMetadata.optString(minecraftVersion); - File modcoreFile = new File(dataDir, "Sk1er Modcore-" + latestRemote + " (" + minecraftVersion + ").jar"); - - if (!modcoreFile.exists() || !localMetadata.optString(minecraftVersion).equalsIgnoreCase(latestRemote) && !failed) { - //File does not exist, or is out of date, download it - File old = new File(dataDir, "Sk1er Modcore-" + localMetadata.optString(minecraftVersion) + " (" + minecraftVersion + ").jar"); - if (old.exists()) old.delete(); - - if (!download("https://static.sk1er.club/repo/mods/modcore/" + latestRemote + "/" + minecraftVersion + "/ModCore-" + latestRemote + " (" + minecraftVersion + ").jar", latestRemote, modcoreFile, minecraftVersion, localMetadata)) { - bail("Unable to download"); - return 2; - } - - } - - addToClasspath(modcoreFile); - - if (!isInitalized()) { - bail("Something went wrong and it did not add the jar to the class path. Local file exists? " + modcoreFile.exists()); - return 3; - } - isRunningModCore = true; - return 0; - } - - - public static void addToClasspath(File file) { - try { - URL url = file.toURI().toURL(); - - ClassLoader classLoader = ModCoreInstaller.class.getClassLoader(); - Method method = classLoader.getClass().getDeclaredMethod("addURL", URL.class); - method.setAccessible(true); - method.invoke(classLoader, url); - } catch (Exception e) { - throw new RuntimeException("Unexpected exception", e); - } - } - - private static boolean download(String url, String version, File file, String mcver, JsonHolder versionData) { - url = url.replace(" ", "%20"); - System.out.println("Downloading ModCore " + " version " + version + " from: " + url); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { - e.printStackTrace(); - } - - JFrame frame = new JFrame("ModCore Initializer"); - JProgressBar bar = new JProgressBar(); - JLabel label = new JLabel("Downloading ModCore " + version, SwingConstants.CENTER); - label.setSize(600, 120); - frame.getContentPane().add(label); - frame.getContentPane().add(bar); - GroupLayout layout = new GroupLayout(frame.getContentPane()); - frame.getContentPane().setLayout(layout); - layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(label, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) - .addComponent(bar, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap())); - layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(label, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bar, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - frame.setResizable(false); - bar.setBorderPainted(true); - bar.setMinimum(0); - bar.setStringPainted(true); - Font font = bar.getFont(); - bar.setFont(new Font(font.getName(), font.getStyle(), font.getSize() * 2)); - label.setFont(new Font(font.getName(), font.getStyle(), font.getSize() * 2)); - frame.pack(); - frame.setLocationRelativeTo(null); - frame.setVisible(true); - - HttpURLConnection connection = null; - InputStream is = null; - try (FileOutputStream outputStream = new FileOutputStream(file)) { - URL u = new URL(url); - connection = (HttpURLConnection) u.openConnection(); - connection.setRequestMethod("GET"); - connection.setUseCaches(true); - connection.addRequestProperty("User-Agent", "Mozilla/4.76 (Sk1er Modcore Initializer)"); - connection.setReadTimeout(15000); - connection.setConnectTimeout(15000); - connection.setDoOutput(true); - is = connection.getInputStream(); - int contentLength = connection.getContentLength(); - byte[] buffer = new byte[1024]; - System.out.println("MAX: " + contentLength); - bar.setMaximum(contentLength); - int read; - bar.setValue(0); - while ((read = is.read(buffer)) > 0) { - outputStream.write(buffer, 0, read); - bar.setValue(bar.getValue() + 1024); - } - FileUtils.write(new File(dataDir, "metadata.json"), versionData.put(mcver, version).toString()); - } catch (Exception e) { - e.printStackTrace(); - frame.dispose(); - return false; - } finally { - try { - if (connection != null) { - connection.disconnect(); - } - - if (is != null) { - is.close(); - } - } catch (Exception e) { - System.out.println("Failed cleaning up ModCoreInstaller#download"); - e.printStackTrace(); - } - } - - frame.dispose(); - return true; - } - - public static JsonHolder fetchJSON(String url) { - return new JsonHolder(fetchString(url)); - } - - public static String fetchString(String url) { - url = url.replace(" ", "%20"); - System.out.println("Fetching " + url); - - HttpURLConnection connection = null; - InputStream is = null; - try { - URL u = new URL(url); - connection = (HttpURLConnection) u.openConnection(); - connection.setRequestMethod("GET"); - connection.setUseCaches(true); - connection.addRequestProperty("User-Agent", "Mozilla/4.76 (Sk1er ModCore)"); - connection.setReadTimeout(15000); - connection.setConnectTimeout(15000); - connection.setDoOutput(true); - is = connection.getInputStream(); - return IOUtils.toString(is, Charset.defaultCharset()); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (connection != null) { - connection.disconnect(); - } - - if (is != null) { - is.close(); - } - } catch (Exception e) { - System.out.println("Failed cleaning up ModCoreInstaller#fetchString"); - e.printStackTrace(); - } - } - - return "Failed to fetch"; - } - - - //Added because we need to use before ModCore is loaded - static class JsonHolder { - private JsonObject object; - - public JsonHolder(JsonObject object) { - this.object = object; - } - - public JsonHolder(String raw) { - if (raw == null) - object = new JsonObject(); - else - try { - this.object = new JsonParser().parse(raw).getAsJsonObject(); - } catch (Exception e) { - this.object = new JsonObject(); - e.printStackTrace(); - } - } - - public JsonHolder() { - this(new JsonObject()); - } - - @Override - public String toString() { - if (object != null) - return object.toString(); - return "{}"; - } - - public JsonHolder put(String key, boolean value) { - object.addProperty(key, value); - return this; - } - - public void mergeNotOverride(JsonHolder merge) { - merge(merge, false); - } - - public void mergeOverride(JsonHolder merge) { - merge(merge, true); - } - - public void merge(JsonHolder merge, boolean override) { - JsonObject object = merge.getObject(); - for (String s : merge.getKeys()) { - if (override || !this.has(s)) - put(s, object.get(s)); - } - } - - private void put(String s, JsonElement element) { - this.object.add(s, element); - } - - public JsonHolder put(String key, String value) { - object.addProperty(key, value); - return this; - } - - public JsonHolder put(String key, int value) { - object.addProperty(key, value); - return this; - } - - public JsonHolder put(String key, double value) { - object.addProperty(key, value); - return this; - } - - public JsonHolder put(String key, long value) { - object.addProperty(key, value); - return this; - } - - private JsonHolder defaultOptJSONObject(String key, JsonObject fallBack) { - try { - return new JsonHolder(object.get(key).getAsJsonObject()); - } catch (Exception e) { - return new JsonHolder(fallBack); - } - } - - public JsonArray defaultOptJSONArray(String key, JsonArray fallback) { - try { - return object.get(key).getAsJsonArray(); - } catch (Exception e) { - return fallback; - } - } - - public JsonArray optJSONArray(String key) { - return defaultOptJSONArray(key, new JsonArray()); - } - - - public boolean has(String key) { - return object.has(key); - } - - public long optLong(String key, long fallback) { - try { - return object.get(key).getAsLong(); - } catch (Exception e) { - return fallback; - } - } - - public long optLong(String key) { - return optLong(key, 0); - } - - public boolean optBoolean(String key, boolean fallback) { - try { - return object.get(key).getAsBoolean(); - } catch (Exception e) { - return fallback; - } - } - - public boolean optBoolean(String key) { - return optBoolean(key, false); - } - - public JsonObject optActualJSONObject(String key) { - try { - return object.get(key).getAsJsonObject(); - } catch (Exception e) { - return new JsonObject(); - } - } - - public JsonHolder optJSONObject(String key) { - return defaultOptJSONObject(key, new JsonObject()); - } - - - public int optInt(String key, int fallBack) { - try { - return object.get(key).getAsInt(); - } catch (Exception e) { - return fallBack; - } - } - - public int optInt(String key) { - return optInt(key, 0); - } - - - public String defaultOptString(String key, String fallBack) { - try { - return object.get(key).getAsString(); - } catch (Exception e) { - return fallBack; - } - } - - public String optString(String key) { - return defaultOptString(key, ""); - } - - - public double optDouble(String key, double fallBack) { - try { - return object.get(key).getAsDouble(); - } catch (Exception e) { - return fallBack; - } - } - - public List getKeys() { - List tmp = new ArrayList<>(); - for (Map.Entry e : object.entrySet()) { - tmp.add(e.getKey()); - } - return tmp; - } - - public double optDouble(String key) { - return optDouble(key, 0.0); - } - - - public JsonObject getObject() { - return object; - } - - public boolean isNull(String key) { - return object.has(key) && object.get(key).isJsonNull(); - } - - public JsonHolder put(String values, JsonHolder values1) { - return put(values, values1.getObject()); - } - - public JsonHolder put(String values, JsonObject object) { - this.object.add(values, object); - return this; - } - - public void put(String blacklisted, JsonArray jsonElements) { - this.object.add(blacklisted, jsonElements); - } - - public void remove(String header) { - object.remove(header); - } - } - - -} \ No newline at end of file diff --git a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java b/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java index dd48d4c..9374d1e 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java @@ -40,12 +40,11 @@ public class PerspectiveMod { @Mod.EventHandler public void init(FMLInitializationEvent event) { - ModCoreInstaller.initializeModCore(Minecraft.getMinecraft().mcDataDir); - config.preload(); ClientRegistry.registerKeyBinding(perspectiveKey); - ClientCommandHandler.instance.registerCommand(new PerspectiveModCommand()); + new PerspectiveModCommand("perspectivemod").register(); + new PerspectiveModCommand("pmod").register(); MinecraftForge.EVENT_BUS.register(this); } @@ -83,6 +82,7 @@ public class PerspectiveMod { } else { enterPerspective(); } + mc.renderGlobal.setDisplayListEntitiesDirty(); } else if (config.holdMode) { resetPerspective(); } @@ -100,6 +100,7 @@ public class PerspectiveMod { public void resetPerspective() { perspectiveToggled = false; mc.gameSettings.thirdPersonView = previousPerspective; + mc.renderGlobal.setDisplayListEntitiesDirty(); } public boolean overrideMouse() { diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java index ac47621..3b6a5ae 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java @@ -3,8 +3,6 @@ package me.djtheredstoner.perspectivemod.asm.transformers; import me.djtheredstoner.perspectivemod.asm.ITransformer; import org.objectweb.asm.tree.*; -import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.Iterator; import static org.objectweb.asm.Opcodes.*; diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java index 2a98619..ca1874b 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java @@ -36,7 +36,8 @@ public class MinecraftTransformer implements ITransformer { String ownerName = mapClassName(insn.owner); String fieldName = mapFieldNameFromNode(insn); - if (ownerName.equals("net/minecraft/client/settings/GameSettings") && (fieldName.equals("thirdPersonView") || fieldName.equals("field_74320_O")) && insn.desc.equals("I")) { + if (ownerName.equals("net/minecraft/client/settings/GameSettings") && + (fieldName.equals("thirdPersonView") || fieldName.equals("field_74320_O")) && insn.desc.equals("I")) { method.instructions.insertBefore(insn, insertThirdPersonHook()); method.instructions.remove(insn); } diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java index fee214a..e41b81a 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java @@ -1,7 +1,6 @@ package me.djtheredstoner.perspectivemod.asm.transformers; import me.djtheredstoner.perspectivemod.asm.ITransformer; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import org.objectweb.asm.tree.*; import java.util.Iterator; diff --git a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java b/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java index cad7f79..00b0d27 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java @@ -1,60 +1,19 @@ package me.djtheredstoner.perspectivemod.commands; -import club.sk1er.mods.core.ModCore; +import gg.essential.api.EssentialAPI; +import gg.essential.api.commands.Command; +import gg.essential.api.commands.DefaultHandler; import me.djtheredstoner.perspectivemod.PerspectiveMod; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import java.util.Collections; -import java.util.List; +public class PerspectiveModCommand extends Command { -public class PerspectiveModCommand extends CommandBase { - - private final String PREFIX = "§c[§6Perspective Mod§c] §r"; - - @Override - public String getCommandName() { - return "perspectivemod"; - } - - @Override - public List getCommandAliases() { - return Collections.singletonList("pmod"); + public PerspectiveModCommand(String name) { + super(name); } - @Override - public String getCommandUsage(ICommandSender sender) { - return "§6Perspective Mod Help\n" + - "§b/pmod §7- Enables or disables the mod.\n" + - "§b/pmod mode §7- Changes the mode.\n" + - "§7Edit the keybind in the minecraft controls menu."; + @DefaultHandler + public void handle() { + EssentialAPI.getGuiUtil().openScreen(PerspectiveMod.instance.config.gui()); } - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length == 1 && args[0].equals("eW91IGZvdW5kIGEgc2VjcmV0IQo=")) { - sendMessage("you found a secret!"); - } else { - ModCore.getInstance().getGuiHandler().open(PerspectiveMod.instance.config.gui()); - } - } - - @Override - public int getRequiredPermissionLevel() { - return -1; - } - - private void sendHelp() { - sendMessage(getCommandUsage(Minecraft.getMinecraft().thePlayer), false); - } - - private void sendMessage(String message, boolean addPrefix) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((addPrefix ? PREFIX : "") + message)); - } - - private void sendMessage(String message) { - sendMessage(message, true); - } } diff --git a/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java b/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java index 3f15069..dd10623 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java @@ -1,8 +1,8 @@ package me.djtheredstoner.perspectivemod.config; -import club.sk1er.vigilance.Vigilant; -import club.sk1er.vigilance.data.Property; -import club.sk1er.vigilance.data.PropertyType; +import gg.essential.vigilance.Vigilant; +import gg.essential.vigilance.data.Property; +import gg.essential.vigilance.data.PropertyType; import java.io.File; diff --git a/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java b/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java index f5128f0..695f7a2 100644 --- a/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java +++ b/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java @@ -1,6 +1,5 @@ package me.djtheredstoner.perspectivemod.forge; -import me.djtheredstoner.perspectivemod.ModCoreInstaller; import me.djtheredstoner.perspectivemod.asm.ClassTransformer; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.common.ForgeVersion; @@ -53,17 +52,6 @@ public class PerspectiveModTweaker implements IFMLLoadingPlugin { @Override public String[] getASMTransformerClass() { - int initialize = ModCoreInstaller.initialize(Launch.minecraftHome, "1.8.9"); - - if (ModCoreInstaller.isErrored() || initialize != 0 && initialize != -1) { - System.out.println("Failed to load Sk1er Modcore - " + initialize + " - " + ModCoreInstaller.getError()); - } - // If true the classes are loaded - if (ModCoreInstaller.isIsRunningModCore()) { - // register ModCore's class transformer - return new String[]{"club.sk1er.mods.core.forge.ClassTransformer", ClassTransformer.class.getName()}; - } - return new String[]{ClassTransformer.class.getName()}; } -- cgit