|
| 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.module; |
| 6 | + |
| 7 | +import com.veteran.hack.util.*; |
| 8 | +import net.minecraft.client.*; |
| 9 | +import com.veteran.hack.setting.*; |
| 10 | +import com.google.common.base.*; |
| 11 | +import java.util.*; |
| 12 | +import com.veteran.hack.event.events.*; |
| 13 | +import com.veteran.hack.*; |
| 14 | +import com.veteran.hack.setting.builder.*; |
| 15 | +import com.google.gson.*; |
| 16 | +import org.lwjgl.input.*; |
| 17 | +import java.lang.annotation.*; |
| 18 | + |
| 19 | +public class Module |
| 20 | +{ |
| 21 | + private final String originalName; |
| 22 | + private final Category category; |
| 23 | + private final String description; |
| 24 | + private final Setting<String> name; |
| 25 | + private Setting<Bind> bind; |
| 26 | + private Setting<Boolean> enabled; |
| 27 | + private Setting<ShowOnArray> showOnArray; |
| 28 | + public boolean alwaysListening; |
| 29 | + protected static final Minecraft mc; |
| 30 | + public List<Setting> settingList; |
| 31 | + |
| 32 | + public Module() { |
| 33 | + this.originalName = this.getAnnotation().name(); |
| 34 | + this.category = this.getAnnotation().category(); |
| 35 | + this.description = this.getAnnotation().description(); |
| 36 | + this.name = this.register(Settings.s("Name", this.originalName)); |
| 37 | + this.bind = this.register(Settings.custom("Bind", Bind.none(), new BindConverter()).build()); |
| 38 | + this.enabled = this.register(Settings.booleanBuilder("Enabled").withVisibility(aBoolean -> false).withValue(false).build()); |
| 39 | + this.showOnArray = this.register(Settings.e("Visible", this.getAnnotation().showOnArray())); |
| 40 | + this.settingList = new ArrayList<Setting>(); |
| 41 | + this.alwaysListening = this.getAnnotation().alwaysListening(); |
| 42 | + this.registerAll(this.bind, this.enabled, this.showOnArray); |
| 43 | + } |
| 44 | + |
| 45 | + private Info getAnnotation() { |
| 46 | + if (this.getClass().isAnnotationPresent(Info.class)) { |
| 47 | + return this.getClass().getAnnotation(Info.class); |
| 48 | + } |
| 49 | + throw new IllegalStateException("No Annotation on class " + this.getClass().getCanonicalName() + "!"); |
| 50 | + } |
| 51 | + |
| 52 | + public void onUpdate() { |
| 53 | + } |
| 54 | + |
| 55 | + public void onRender() { |
| 56 | + } |
| 57 | + |
| 58 | + public void onWorldRender(final RenderEvent event) { |
| 59 | + } |
| 60 | + |
| 61 | + public Bind getBind() { |
| 62 | + return this.bind.getValue(); |
| 63 | + } |
| 64 | + |
| 65 | + public ShowOnArray getShowOnArray() { |
| 66 | + return this.showOnArray.getValue(); |
| 67 | + } |
| 68 | + |
| 69 | + public String getBindName() { |
| 70 | + return this.bind.getValue().toString(); |
| 71 | + } |
| 72 | + |
| 73 | + public void setName(final String name) { |
| 74 | + this.name.setValue(name); |
| 75 | + } |
| 76 | + |
| 77 | + public String getOriginalName() { |
| 78 | + return this.originalName; |
| 79 | + } |
| 80 | + |
| 81 | + public String getName() { |
| 82 | + return this.name.getValue(); |
| 83 | + } |
| 84 | + |
| 85 | + public String getChatName() { |
| 86 | + return "[" + this.name.getValue() + "] "; |
| 87 | + } |
| 88 | + |
| 89 | + public String getDescription() { |
| 90 | + return this.description; |
| 91 | + } |
| 92 | + |
| 93 | + public Category getCategory() { |
| 94 | + return this.category; |
| 95 | + } |
| 96 | + |
| 97 | + public boolean isEnabled() { |
| 98 | + return this.enabled.getValue(); |
| 99 | + } |
| 100 | + |
| 101 | + public boolean isOnArray() { |
| 102 | + return this.showOnArray.getValue().equals(ShowOnArray.ON); |
| 103 | + } |
| 104 | + |
| 105 | + protected void onEnable() { |
| 106 | + } |
| 107 | + |
| 108 | + protected void onDisable() { |
| 109 | + } |
| 110 | + |
| 111 | + public void toggle() { |
| 112 | + this.setEnabled(!this.isEnabled()); |
| 113 | + } |
| 114 | + |
| 115 | + public void enable() { |
| 116 | + this.enabled.setValue(true); |
| 117 | + this.onEnable(); |
| 118 | + if (!this.alwaysListening) { |
| 119 | + BaseMod.EVENT_BUS.subscribe((Object)this); |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + public void disable() { |
| 124 | + this.enabled.setValue(false); |
| 125 | + this.onDisable(); |
| 126 | + if (!this.alwaysListening) { |
| 127 | + BaseMod.EVENT_BUS.unsubscribe((Object)this); |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + public boolean isDisabled() { |
| 132 | + return !this.isEnabled(); |
| 133 | + } |
| 134 | + |
| 135 | + public void setEnabled(final boolean enabled) { |
| 136 | + final boolean prev = this.enabled.getValue(); |
| 137 | + if (prev != enabled) { |
| 138 | + if (enabled) { |
| 139 | + this.enable(); |
| 140 | + } |
| 141 | + else { |
| 142 | + this.disable(); |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | + |
| 147 | + public String getHudInfo() { |
| 148 | + return null; |
| 149 | + } |
| 150 | + |
| 151 | + protected final void setAlwaysListening(final boolean alwaysListening) { |
| 152 | + this.alwaysListening = alwaysListening; |
| 153 | + if (alwaysListening) { |
| 154 | + BaseMod.EVENT_BUS.subscribe((Object)this); |
| 155 | + } |
| 156 | + if (!alwaysListening && this.isDisabled()) { |
| 157 | + BaseMod.EVENT_BUS.unsubscribe((Object)this); |
| 158 | + } |
| 159 | + } |
| 160 | + |
| 161 | + public void destroy() { |
| 162 | + } |
| 163 | + |
| 164 | + protected void registerAll(final Setting... settings) { |
| 165 | + for (final Setting setting : settings) { |
| 166 | + this.register((Setting<Object>)setting); |
| 167 | + } |
| 168 | + } |
| 169 | + |
| 170 | + protected <T> Setting<T> register(final Setting<T> setting) { |
| 171 | + if (this.settingList == null) { |
| 172 | + this.settingList = new ArrayList<Setting>(); |
| 173 | + } |
| 174 | + this.settingList.add(setting); |
| 175 | + return SettingBuilder.register(setting, "modules." + this.originalName); |
| 176 | + } |
| 177 | + |
| 178 | + protected <T> Setting<T> register(final SettingBuilder<T> builder) { |
| 179 | + if (this.settingList == null) { |
| 180 | + this.settingList = new ArrayList<Setting>(); |
| 181 | + } |
| 182 | + final Setting<T> setting = builder.buildAndRegister("modules." + this.name); |
| 183 | + this.settingList.add(setting); |
| 184 | + return setting; |
| 185 | + } |
| 186 | + |
| 187 | + static { |
| 188 | + mc = Minecraft.getMinecraft(); |
| 189 | + } |
| 190 | + |
| 191 | + public enum ShowOnArray |
| 192 | + { |
| 193 | + ON, |
| 194 | + OFF; |
| 195 | + } |
| 196 | + |
| 197 | + public enum Category |
| 198 | + { |
| 199 | + CHAT("Chat", false), |
| 200 | + COMBAT("Combat", false), |
| 201 | + EXPERIMENTAL("Experimental", false), |
| 202 | + GUI("GUI", false), |
| 203 | + HIDDEN("Hidden", true), |
| 204 | + MISC("Misc", false), |
| 205 | + MOVEMENT("Movement", false), |
| 206 | + PLAYER("Player", false), |
| 207 | + RENDER("Render", false), |
| 208 | + UTILS("Utils", true), |
| 209 | + EXPLOIT("Exploits", false); |
| 210 | + |
| 211 | + boolean hidden; |
| 212 | + String name; |
| 213 | + |
| 214 | + private Category(final String name, final boolean hidden) { |
| 215 | + this.name = name; |
| 216 | + this.hidden = hidden; |
| 217 | + } |
| 218 | + |
| 219 | + public boolean isHidden() { |
| 220 | + return this.hidden; |
| 221 | + } |
| 222 | + |
| 223 | + public String getName() { |
| 224 | + return this.name; |
| 225 | + } |
| 226 | + } |
| 227 | + |
| 228 | + private class BindConverter extends Converter<Bind, JsonElement> |
| 229 | + { |
| 230 | + protected JsonElement doForward(final Bind bind) { |
| 231 | + return (JsonElement)new JsonPrimitive(bind.toString()); |
| 232 | + } |
| 233 | + |
| 234 | + protected Bind doBackward(final JsonElement jsonElement) { |
| 235 | + String s = jsonElement.getAsString(); |
| 236 | + if (s.equalsIgnoreCase("None")) { |
| 237 | + return Bind.none(); |
| 238 | + } |
| 239 | + boolean ctrl = false; |
| 240 | + boolean alt = false; |
| 241 | + boolean shift = false; |
| 242 | + if (s.startsWith("Ctrl+")) { |
| 243 | + ctrl = true; |
| 244 | + s = s.substring(5); |
| 245 | + } |
| 246 | + if (s.startsWith("Alt+")) { |
| 247 | + alt = true; |
| 248 | + s = s.substring(4); |
| 249 | + } |
| 250 | + if (s.startsWith("Shift+")) { |
| 251 | + shift = true; |
| 252 | + s = s.substring(6); |
| 253 | + } |
| 254 | + int key = -1; |
| 255 | + try { |
| 256 | + key = Keyboard.getKeyIndex(s.toUpperCase()); |
| 257 | + } |
| 258 | + catch (Exception ex) {} |
| 259 | + if (key == 0) { |
| 260 | + return Bind.none(); |
| 261 | + } |
| 262 | + return new Bind(ctrl, alt, shift, key); |
| 263 | + } |
| 264 | + } |
| 265 | + |
| 266 | + @Retention(RetentionPolicy.RUNTIME) |
| 267 | + public @interface Info { |
| 268 | + String name(); |
| 269 | + |
| 270 | + String description() default "No description for this module, please report this so it can be fixed at &b"; |
| 271 | + |
| 272 | + Category category(); |
| 273 | + |
| 274 | + boolean alwaysListening() default false; |
| 275 | + |
| 276 | + ShowOnArray showOnArray() default ShowOnArray.ON; |
| 277 | + } |
| 278 | +} |
0 commit comments