|
| 1 | +//Deobfuscated with https://github.com/SimplyProgrammer/Minecraft-Deobfuscator3000 using mappings "C:\Users\u1\Documents\Java Decompiler\1.12 stable mappings"! |
| 2 | + |
| 3 | +//Decompiled by Procyon! |
| 4 | + |
| 5 | +package com.veteran.hack; |
| 6 | + |
| 7 | +import net.minecraftforge.fml.common.*; |
| 8 | +import com.veteran.hack.gui.kami.*; |
| 9 | +import com.google.common.base.*; |
| 10 | +import org.lwjgl.opengl.*; |
| 11 | +import net.minecraftforge.fml.common.event.*; |
| 12 | +import java.util.function.*; |
| 13 | +import net.minecraftforge.common.*; |
| 14 | +import com.veteran.hack.event.*; |
| 15 | +import com.veteran.hack.command.*; |
| 16 | +import com.veteran.hack.setting.*; |
| 17 | +import com.veteran.hack.util.*; |
| 18 | +import com.veteran.hack.module.*; |
| 19 | +import com.veteran.hack.module.modules.misc.*; |
| 20 | +import com.veteran.hack.module.modules.hidden.*; |
| 21 | +import com.veteran.hack.module.modules.render.*; |
| 22 | +import com.veteran.hack.module.modules.gui.*; |
| 23 | +import java.nio.file.*; |
| 24 | +import com.veteran.hack.setting.config.*; |
| 25 | +import com.veteran.hack.gui.rgui.component.container.use.*; |
| 26 | +import com.veteran.hack.gui.rgui.util.*; |
| 27 | +import com.veteran.hack.gui.rgui.component.container.*; |
| 28 | +import com.veteran.hack.gui.rgui.component.*; |
| 29 | +import com.google.gson.*; |
| 30 | +import java.util.*; |
| 31 | +import java.nio.file.attribute.*; |
| 32 | +import java.io.*; |
| 33 | +import org.apache.logging.log4j.*; |
| 34 | +import me.zero.alpine.*; |
| 35 | + |
| 36 | +@Mod(modid = "vethack", name = "Veteran Hack", version = "b2.3") |
| 37 | +public class BaseMod |
| 38 | +{ |
| 39 | + public static final String MODNAME = "Veteran Hack"; |
| 40 | + public static final String MODID = "vethack"; |
| 41 | + public static final String MODVER = "b2.3"; |
| 42 | + public static final String MODVERSMALL = "b2.3"; |
| 43 | + public static final String APP_ID = "692773855667945572"; |
| 44 | + public static final String AUTH_JSON = "https://raw.githubusercontent.com/pol-y-mer/vethackuserJSON/master/users.json"; |
| 45 | + public static final String NAME_LONG = "\u1d20\u1d07\u1d1b\u1d07\u0280\u1d00\u0274 \u029c\u1d00\u1d04\u1d0b"; |
| 46 | + public static final String NAME_SHORT = "\u1d20\u1d07\u1d1b\u029c\u1d00\u1d04\u1d0b"; |
| 47 | + public static final String ONTOP_2B = "Veteran Hack On Top"; |
| 48 | + public static final String NAME_2B = "Veteran Hack"; |
| 49 | + public static final String WEBSITE = "hack.veteran.com :^)"; |
| 50 | + public static final char colour = '§'; |
| 51 | + public static final char separator = '\u23d0'; |
| 52 | + public static final char quoteLeft = '«'; |
| 53 | + public static final char quoteRight = '»'; |
| 54 | + private static final String KAMI_CONFIG_NAME_DEFAULT = "VETHACK.cfg"; |
| 55 | + public static final Logger log; |
| 56 | + public static final EventBus EVENT_BUS; |
| 57 | + @Mod.Instance |
| 58 | + private static BaseMod INSTANCE; |
| 59 | + public KamiGUI guiManager; |
| 60 | + public CommandManager commandManager; |
| 61 | + private Setting<JsonObject> guiStateSetting; |
| 62 | + |
| 63 | + public BaseMod() { |
| 64 | + this.guiStateSetting = Settings.custom("gui", new JsonObject(), new Converter<JsonObject, JsonObject>() { |
| 65 | + protected JsonObject doForward(final JsonObject jsonObject) { |
| 66 | + return jsonObject; |
| 67 | + } |
| 68 | + |
| 69 | + protected JsonObject doBackward(final JsonObject jsonObject) { |
| 70 | + return jsonObject; |
| 71 | + } |
| 72 | + }).buildAndRegister(""); |
| 73 | + } |
| 74 | + |
| 75 | + @Mod.EventHandler |
| 76 | + public void preInit(final FMLPreInitializationEvent event) { |
| 77 | + } |
| 78 | + |
| 79 | + @Mod.EventHandler |
| 80 | + public void postInit(final FMLPostInitializationEvent event) { |
| 81 | + Display.setTitle("Veteran Hack b2.3"); |
| 82 | + } |
| 83 | + |
| 84 | + @Mod.EventHandler |
| 85 | + public void init(final FMLInitializationEvent event) { |
| 86 | + BaseMod.log.info("\n\nInitializing Veteran Hack b2.3"); |
| 87 | + ModuleManager.initialize(); |
| 88 | + ModuleManager.getModules().stream().filter(module -> module.alwaysListening).forEach(BaseMod.EVENT_BUS::subscribe); |
| 89 | + MinecraftForge.EVENT_BUS.register((Object)new ForgeEventProcessor()); |
| 90 | + LagCompensator.INSTANCE = new LagCompensator(); |
| 91 | + Wrapper.init(); |
| 92 | + (this.guiManager = new KamiGUI()).initializeGUI(); |
| 93 | + this.commandManager = new CommandManager(); |
| 94 | + Friends.initFriends(); |
| 95 | + SettingsRegister.register("commandPrefix", Command.commandPrefix); |
| 96 | + loadConfiguration(); |
| 97 | + BaseMod.log.info("Settings loaded"); |
| 98 | + new RichPresence(); |
| 99 | + ModuleManager.getModules().stream().filter(Module::isEnabled).forEach(Module::enable); |
| 100 | + try { |
| 101 | + ModuleManager.getModuleByName("InfoOverlay").setEnabled(true); |
| 102 | + ModuleManager.getModuleByName("InventoryViewer").setEnabled(true); |
| 103 | + ModuleManager.getModuleByName("ActiveModules").setEnabled(true); |
| 104 | + if (((DiscordSettings)ModuleManager.getModuleByName("DiscordSettings")).startupGlobal.getValue()) { |
| 105 | + ModuleManager.getModuleByName("DiscordSettings").setEnabled(true); |
| 106 | + } |
| 107 | + if (((FixGui)ModuleManager.getModuleByName("Hidden:FixGui")).shouldAutoEnable.getValue()) { |
| 108 | + ModuleManager.getModuleByName("Hidden:FixGui").setEnabled(true); |
| 109 | + } |
| 110 | + if (((TabFriends)ModuleManager.getModuleByName("TabFriends")).startupGlobal.getValue()) { |
| 111 | + ModuleManager.getModuleByName("TabFriends").setEnabled(true); |
| 112 | + } |
| 113 | + if (((PrefixChat)ModuleManager.getModuleByName("PrefixChat")).startupGlobal.getValue()) { |
| 114 | + ModuleManager.getModuleByName("PrefixChat").setEnabled(true); |
| 115 | + } |
| 116 | + } |
| 117 | + catch (NullPointerException e) { |
| 118 | + BaseMod.log.error("NPE in loading always enabled modules\n"); |
| 119 | + } |
| 120 | + BaseMod.log.info("Veteran Hack Has been initialized!\n"); |
| 121 | + BaseMod.log.info(" This client is skidded from KAMI BLUE, which is a fork of KAMI. please go check out the original client at https://github.com/s-b99/kamiblue"); |
| 122 | + } |
| 123 | + |
| 124 | + public static String getConfigName() { |
| 125 | + final Path config = Paths.get("VETHACK_LAST.txt", new String[0]); |
| 126 | + String kamiConfigName = "VETHACK.cfg"; |
| 127 | + try (final BufferedReader reader = Files.newBufferedReader(config)) { |
| 128 | + kamiConfigName = reader.readLine(); |
| 129 | + if (!isFilenameValid(kamiConfigName)) { |
| 130 | + kamiConfigName = "VETHACK.cfg"; |
| 131 | + } |
| 132 | + } |
| 133 | + catch (NoSuchFileException e3) { |
| 134 | + try (final BufferedWriter writer = Files.newBufferedWriter(config, new OpenOption[0])) { |
| 135 | + writer.write("VETHACK.cfg"); |
| 136 | + } |
| 137 | + catch (IOException e1) { |
| 138 | + e1.printStackTrace(); |
| 139 | + } |
| 140 | + } |
| 141 | + catch (IOException e2) { |
| 142 | + e2.printStackTrace(); |
| 143 | + } |
| 144 | + return kamiConfigName; |
| 145 | + } |
| 146 | + |
| 147 | + public static void loadConfiguration() { |
| 148 | + try { |
| 149 | + loadConfigurationUnsafe(); |
| 150 | + } |
| 151 | + catch (IOException e) { |
| 152 | + e.printStackTrace(); |
| 153 | + } |
| 154 | + } |
| 155 | + |
| 156 | + public static void loadConfigurationUnsafe() throws IOException { |
| 157 | + final String kamiConfigName = getConfigName(); |
| 158 | + final Path kamiConfig = Paths.get(kamiConfigName, new String[0]); |
| 159 | + if (!Files.exists(kamiConfig, new LinkOption[0])) { |
| 160 | + return; |
| 161 | + } |
| 162 | + Configuration.loadConfiguration(kamiConfig); |
| 163 | + final JsonObject gui = BaseMod.INSTANCE.guiStateSetting.getValue(); |
| 164 | + for (final Map.Entry<String, JsonElement> entry : gui.entrySet()) { |
| 165 | + final Optional<Component> optional = BaseMod.INSTANCE.guiManager.getChildren().stream().filter(component -> component instanceof Frame).filter(component -> component.getTitle().equals(entry.getKey())).findFirst(); |
| 166 | + if (optional.isPresent()) { |
| 167 | + final JsonObject object = entry.getValue().getAsJsonObject(); |
| 168 | + final Frame frame = optional.get(); |
| 169 | + frame.setX(object.get("x").getAsInt()); |
| 170 | + frame.setY(object.get("y").getAsInt()); |
| 171 | + final Docking docking = Docking.values()[object.get("docking").getAsInt()]; |
| 172 | + if (docking.isLeft()) { |
| 173 | + ContainerHelper.setAlignment(frame, AlignedComponent.Alignment.LEFT); |
| 174 | + } |
| 175 | + else if (docking.isRight()) { |
| 176 | + ContainerHelper.setAlignment(frame, AlignedComponent.Alignment.RIGHT); |
| 177 | + } |
| 178 | + else if (docking.isCenterVertical()) { |
| 179 | + ContainerHelper.setAlignment(frame, AlignedComponent.Alignment.CENTER); |
| 180 | + } |
| 181 | + frame.setDocking(docking); |
| 182 | + frame.setMinimized(object.get("minimized").getAsBoolean()); |
| 183 | + frame.setPinned(object.get("pinned").getAsBoolean()); |
| 184 | + } |
| 185 | + else { |
| 186 | + System.err.println("Found GUI config entry for " + entry.getKey() + ", but found no frame with that name"); |
| 187 | + } |
| 188 | + } |
| 189 | + getInstance().getGuiManager().getChildren().stream().filter(component -> component instanceof Frame && component.isPinnable() && component.isVisible()).forEach(component -> component.setOpacity(0.0f)); |
| 190 | + } |
| 191 | + |
| 192 | + public static void saveConfiguration() { |
| 193 | + try { |
| 194 | + saveConfigurationUnsafe(); |
| 195 | + } |
| 196 | + catch (IOException e) { |
| 197 | + e.printStackTrace(); |
| 198 | + } |
| 199 | + } |
| 200 | + |
| 201 | + public static void saveConfigurationUnsafe() throws IOException { |
| 202 | + final JsonObject object = new JsonObject(); |
| 203 | + final JsonObject frameObject; |
| 204 | + final JsonObject jsonObject; |
| 205 | + BaseMod.INSTANCE.guiManager.getChildren().stream().filter(component -> component instanceof Frame).map(component -> component).forEach(frame -> { |
| 206 | + frameObject = new JsonObject(); |
| 207 | + frameObject.add("x", (JsonElement)new JsonPrimitive((Number)frame.getX())); |
| 208 | + frameObject.add("y", (JsonElement)new JsonPrimitive((Number)frame.getY())); |
| 209 | + frameObject.add("docking", (JsonElement)new JsonPrimitive((Number)Arrays.asList(Docking.values()).indexOf(frame.getDocking()))); |
| 210 | + frameObject.add("minimized", (JsonElement)new JsonPrimitive(Boolean.valueOf(frame.isMinimized()))); |
| 211 | + frameObject.add("pinned", (JsonElement)new JsonPrimitive(Boolean.valueOf(frame.isPinned()))); |
| 212 | + jsonObject.add(frame.getTitle(), (JsonElement)frameObject); |
| 213 | + return; |
| 214 | + }); |
| 215 | + BaseMod.INSTANCE.guiStateSetting.setValue(object); |
| 216 | + final Path outputFile = Paths.get(getConfigName(), new String[0]); |
| 217 | + if (!Files.exists(outputFile, new LinkOption[0])) { |
| 218 | + Files.createFile(outputFile, (FileAttribute<?>[])new FileAttribute[0]); |
| 219 | + } |
| 220 | + Configuration.saveConfiguration(outputFile); |
| 221 | + ModuleManager.getModules().forEach(Module::destroy); |
| 222 | + } |
| 223 | + |
| 224 | + public static boolean isFilenameValid(final String file) { |
| 225 | + final File f = new File(file); |
| 226 | + try { |
| 227 | + f.getCanonicalPath(); |
| 228 | + return true; |
| 229 | + } |
| 230 | + catch (IOException e) { |
| 231 | + return false; |
| 232 | + } |
| 233 | + } |
| 234 | + |
| 235 | + public static BaseMod getInstance() { |
| 236 | + return BaseMod.INSTANCE; |
| 237 | + } |
| 238 | + |
| 239 | + public KamiGUI getGuiManager() { |
| 240 | + return this.guiManager; |
| 241 | + } |
| 242 | + |
| 243 | + public CommandManager getCommandManager() { |
| 244 | + return this.commandManager; |
| 245 | + } |
| 246 | + |
| 247 | + static { |
| 248 | + log = LogManager.getLogger("VETERAN"); |
| 249 | + EVENT_BUS = (EventBus)new EventManager(); |
| 250 | + } |
| 251 | + |
| 252 | + public class User |
| 253 | + { |
| 254 | + public String uuid; |
| 255 | + } |
| 256 | +} |
0 commit comments