|
68 | 68 | import java.util.List; |
69 | 69 | import java.util.UUID; |
70 | 70 |
|
71 | | - |
72 | 71 | public class AxolotlClient implements ClientModInitializer { |
73 | | - public static String modid = "AxolotlClient"; |
74 | 72 |
|
75 | | - public static AxolotlClientConfig CONFIG; |
76 | | - public static io.github.axolotlclient.AxolotlclientConfig.ConfigManager configManager; |
77 | | - public static HashMap<UUID, Boolean> playerCache = new HashMap<>(); |
78 | | - |
79 | | - public static HashMap<Identifier, Resource> runtimeResources = new HashMap<>(); |
| 73 | + public static String modid = "AxolotlClient"; |
| 74 | + |
| 75 | + public static AxolotlClientConfig CONFIG; |
| 76 | + public static io.github.axolotlclient.AxolotlclientConfig.ConfigManager configManager; |
| 77 | + public static HashMap<UUID, Boolean> playerCache = new HashMap<>(); |
80 | 78 |
|
81 | | - public static final Identifier badgeIcon = new Identifier("axolotlclient", "textures/badge.png"); |
| 79 | + public static HashMap<Identifier, Resource> runtimeResources = new HashMap<>(); |
82 | 80 |
|
83 | | - public static final OptionCategory config = new OptionCategory("storedOptions"); |
84 | | - public static final BooleanOption someNiceBackground = new BooleanOption("defNoSecret", false); |
85 | | - public static final List<AbstractModule> modules= new ArrayList<>(); |
| 81 | + public static final Identifier badgeIcon = new Identifier("axolotlclient", "textures/badge.png"); |
86 | 82 |
|
87 | | - private static int tickTime = 0; |
| 83 | + public static final OptionCategory config = new OptionCategory("storedOptions"); |
| 84 | + public static final BooleanOption someNiceBackground = new BooleanOption("defNoSecret", false); |
| 85 | + public static final List<AbstractModule> modules = new ArrayList<>(); |
88 | 86 |
|
89 | | - public static UnsupportedMod badmod; |
90 | | - public static boolean titleDisclaimer = false; |
91 | | - public static boolean showWarning = true; |
| 87 | + private static int tickTime = 0; |
92 | 88 |
|
93 | | - @Override |
94 | | - public void onInitializeClient(ModContainer container) { |
| 89 | + public static UnsupportedMod badmod; |
| 90 | + public static boolean titleDisclaimer = false; |
| 91 | + public static boolean showWarning = true; |
95 | 92 |
|
96 | | - if (QuiltLoader.isModLoaded("ares")){ |
97 | | - badmod = new UnsupportedMod("Ares Client", UnsupportedMod.UnsupportedReason.BAN_REASON); |
98 | | - } else if (QuiltLoader.isModLoaded("inertia")) { |
| 93 | + @Override |
| 94 | + public void onInitializeClient(ModContainer container) { |
| 95 | + if (QuiltLoader.isModLoaded("ares")) { |
| 96 | + badmod = new UnsupportedMod("Ares Client", UnsupportedMod.UnsupportedReason.BAN_REASON); |
| 97 | + } else if (QuiltLoader.isModLoaded("inertia")) { |
99 | 98 | badmod = new UnsupportedMod("Inertia Client", UnsupportedMod.UnsupportedReason.BAN_REASON); |
100 | | - } else if (QuiltLoader.isModLoaded("meteor-client")) { |
| 99 | + } else if (QuiltLoader.isModLoaded("meteor-client")) { |
101 | 100 | badmod = new UnsupportedMod("Meteor Client", UnsupportedMod.UnsupportedReason.BAN_REASON); |
102 | | - } else if (QuiltLoader.isModLoaded("wurst")) { |
| 101 | + } else if (QuiltLoader.isModLoaded("wurst")) { |
103 | 102 | badmod = new UnsupportedMod("Wurst Client", UnsupportedMod.UnsupportedReason.BAN_REASON); |
104 | | - } else if (QuiltLoader.isModLoaded("baritone")) { |
| 103 | + } else if (QuiltLoader.isModLoaded("baritone")) { |
105 | 104 | badmod = new UnsupportedMod("Baritone", UnsupportedMod.UnsupportedReason.BAN_REASON); |
106 | | - } else if (QuiltLoader.isModLoaded("xaerominimap")) { |
| 105 | + } else if (QuiltLoader.isModLoaded("xaerominimap")) { |
107 | 106 | badmod = new UnsupportedMod("Xaero's Minimap", UnsupportedMod.UnsupportedReason.UNKNOWN_CONSEQUENSES); |
108 | 107 | } else if (QuiltLoader.isModLoaded("essential-container")) { |
109 | | - badmod = new UnsupportedMod("Essential", UnsupportedMod.UnsupportedReason.MIGHT_CRASH, UnsupportedMod.UnsupportedReason.UNKNOWN_CONSEQUENSES); |
110 | | - } else if (QuiltLoader.isModLoaded("optifabric")) { |
111 | | - badmod = new UnsupportedMod("OptiFine", UnsupportedMod.UnsupportedReason.MIGHT_CRASH, UnsupportedMod.UnsupportedReason.UNKNOWN_CONSEQUENSES); |
112 | | - } else { |
113 | | - showWarning = false; |
114 | | - } |
| 108 | + badmod = new UnsupportedMod("Essential", UnsupportedMod.UnsupportedReason.MIGHT_CRASH, |
| 109 | + UnsupportedMod.UnsupportedReason.UNKNOWN_CONSEQUENSES); |
| 110 | + } else if (QuiltLoader.isModLoaded("optifabric")) { |
| 111 | + badmod = new UnsupportedMod("OptiFine", UnsupportedMod.UnsupportedReason.MIGHT_CRASH, |
| 112 | + UnsupportedMod.UnsupportedReason.UNKNOWN_CONSEQUENSES); |
| 113 | + } else { |
| 114 | + showWarning = false; |
| 115 | + } |
115 | 116 |
|
116 | | - CONFIG = new AxolotlClientConfig(); |
117 | | - config.add(someNiceBackground); |
| 117 | + CONFIG = new AxolotlClientConfig(); |
| 118 | + config.add(someNiceBackground); |
118 | 119 |
|
119 | | - getModules(); |
120 | | - addExternalModules(); |
| 120 | + getModules(); |
| 121 | + addExternalModules(); |
121 | 122 |
|
122 | | - CONFIG.init(); |
123 | | - modules.forEach(AbstractModule::init); |
| 123 | + CONFIG.init(); |
| 124 | + modules.forEach(AbstractModule::init); |
124 | 125 |
|
125 | | - CONFIG.getConfig().addAll(CONFIG.getCategories()); |
126 | | - CONFIG.getConfig().add(config); |
| 126 | + CONFIG.getConfig().addAll(CONFIG.getCategories()); |
| 127 | + CONFIG.getConfig().add(config); |
127 | 128 |
|
128 | | - AxolotlClientConfigManager.registerConfig(modid, CONFIG, configManager = new DefaultConfigManager(modid, QuiltLoader.getConfigDir().resolve("AxolotlClient.json"), CONFIG.getConfig())); |
129 | | - AxolotlClientConfigManager.addIgnoredName(modid, "x"); |
130 | | - AxolotlClientConfigManager.addIgnoredName(modid, "y"); |
| 129 | + AxolotlClientConfigManager.registerConfig(modid, CONFIG, configManager = new DefaultConfigManager(modid, |
| 130 | + QuiltLoader.getConfigDir().resolve("AxolotlClient.json"), CONFIG.getConfig())); |
| 131 | + AxolotlClientConfigManager.addIgnoredName(modid, "x"); |
| 132 | + AxolotlClientConfigManager.addIgnoredName(modid, "y"); |
131 | 133 |
|
132 | | - modules.forEach(AbstractModule::lateInit); |
| 134 | + modules.forEach(AbstractModule::lateInit); |
133 | 135 |
|
134 | | - ResourceLoader.registerBuiltinResourcePack(new Identifier("axolotlclient", "axolotlclient-ui"), container, ResourcePackActivationType.NORMAL); |
135 | | - ClientTickEvents.END.register(client -> tickClient()); |
| 136 | + ResourceLoader.registerBuiltinResourcePack(new Identifier("axolotlclient", "axolotlclient-ui"), container, |
| 137 | + ResourcePackActivationType.NORMAL); |
| 138 | + ClientTickEvents.END.register(client -> tickClient()); |
136 | 139 |
|
137 | | - FeatureDisabler.init(); |
| 140 | + FeatureDisabler.init(); |
138 | 141 |
|
139 | | - Logger.debug("Debug Output activated, Logs will be more verbose!"); |
| 142 | + Logger.debug("Debug Output activated, Logs will be more verbose!"); |
140 | 143 |
|
141 | | - Logger.info("AxolotlClient Initialized"); |
142 | | - } |
| 144 | + Logger.info("AxolotlClient Initialized"); |
| 145 | + } |
143 | 146 |
|
144 | | - public static void getModules(){ |
145 | | - modules.add(SkyResourceManager.getInstance()); |
146 | | - modules.add(Zoom.getInstance()); |
147 | | - modules.add(HudManager.getInstance()); |
148 | | - modules.add(HypixelMods.getInstance()); |
149 | | - modules.add(MotionBlur.getInstance()); |
| 147 | + public static void getModules() { |
| 148 | + modules.add(SkyResourceManager.getInstance()); |
| 149 | + modules.add(Zoom.getInstance()); |
| 150 | + modules.add(HudManager.getInstance()); |
| 151 | + modules.add(HypixelMods.getInstance()); |
| 152 | + modules.add(MotionBlur.getInstance()); |
150 | 153 | modules.add(ScrollableTooltips.getInstance()); |
151 | 154 | modules.add(DiscordRPC.getInstance()); |
152 | 155 | modules.add(Freelook.getInstance()); |
153 | 156 | modules.add(TntTime.getInstance()); |
154 | 157 | modules.add(Particles.getInstance()); |
155 | | - modules.add(ScreenshotUtils.getInstance()); |
156 | | - } |
157 | | - |
158 | | - private static void addExternalModules(){ |
159 | | - modules.addAll(ModuleLoader.loadExternalModules()); |
160 | | - } |
161 | | - |
162 | | - public static boolean isUsingClient(UUID uuid){ |
163 | | - assert MinecraftClient.getInstance().player != null; |
164 | | - if (uuid == MinecraftClient.getInstance().player.getUuid()){ |
165 | | - return true; |
166 | | - } else { |
167 | | - return NetworkHelper.getOnline(uuid); |
168 | | - } |
169 | | - } |
170 | | - |
171 | | - public static void tickClient(){ |
172 | | - |
| 158 | + modules.add(ScreenshotUtils.getInstance()); |
| 159 | + } |
| 160 | + |
| 161 | + private static void addExternalModules() { |
| 162 | + modules.addAll(ModuleLoader.loadExternalModules()); |
| 163 | + } |
| 164 | + |
| 165 | + public static boolean isUsingClient(UUID uuid) { |
| 166 | + assert MinecraftClient.getInstance().player != null; |
| 167 | + if (uuid == MinecraftClient.getInstance().player.getUuid()) { |
| 168 | + return true; |
| 169 | + } else { |
| 170 | + return NetworkHelper.getOnline(uuid); |
| 171 | + } |
| 172 | + } |
| 173 | + |
| 174 | + public static void tickClient() { |
173 | 175 | modules.forEach(AbstractModule::tick); |
174 | 176 |
|
175 | | - if (tickTime >=6000){ |
176 | | - |
177 | | - //System.out.println("Cleared Cache of Other Players!"); |
178 | | - if(playerCache.values().size()>500){ |
179 | | - playerCache.clear(); |
180 | | - } |
181 | | - tickTime = 0; |
182 | | - } |
183 | | - tickTime++; |
184 | | - |
185 | | - } |
186 | | - |
187 | | - public static void addBadge(Entity entity, MatrixStack matrices){ |
188 | | - if(entity instanceof PlayerEntity && !entity.isSneaky()){ |
189 | | - |
190 | | - if(AxolotlClient.CONFIG.showBadges.get() && AxolotlClient.isUsingClient(entity.getUuid())) { |
| 177 | + if (tickTime >= 6000) { |
| 178 | + //System.out.println("Cleared Cache of Other Players!"); |
| 179 | + if (playerCache.values().size() > 500) { |
| 180 | + playerCache.clear(); |
| 181 | + } |
| 182 | + tickTime = 0; |
| 183 | + } |
| 184 | + tickTime++; |
| 185 | + } |
| 186 | + |
| 187 | + public static void addBadge(Entity entity, MatrixStack matrices) { |
| 188 | + if (entity instanceof PlayerEntity && !entity.isSneaky()) { |
| 189 | + if (AxolotlClient.CONFIG.showBadges.get() && AxolotlClient.isUsingClient(entity.getUuid())) { |
191 | 190 | RenderSystem.enableDepthTest(); |
192 | | - RenderSystem.setShaderTexture(0, AxolotlClient.badgeIcon); |
193 | | - |
194 | | - assert MinecraftClient.getInstance().player != null; |
195 | | - int x = -(MinecraftClient.getInstance().textRenderer.getWidth( |
196 | | - entity.getUuid() == MinecraftClient.getInstance().player.getUuid()? |
197 | | - (NickHider.getInstance().hideOwnName.get() ? NickHider.getInstance().hiddenNameSelf.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString()): |
198 | | - (NickHider.getInstance().hideOtherNames.get() ? NickHider.getInstance().hiddenNameOthers.get(): Team.decorateName(entity.getScoreboardTeam(), entity.getName()).getString()) |
199 | | - )/2 + (AxolotlClient.CONFIG.customBadge.get() ? MinecraftClient.getInstance().textRenderer.getWidth(" "+ Formatting.strip(AxolotlClient.CONFIG.badgeText.get())): 10)); |
200 | | - |
201 | | - RenderSystem.setShaderColor(1, 1, 1, 1); |
202 | | - |
203 | | - if(AxolotlClient.CONFIG.customBadge.get()) { |
| 191 | + RenderSystem.setShaderTexture(0, AxolotlClient.badgeIcon); |
| 192 | + |
| 193 | + assert MinecraftClient.getInstance().player != null; |
| 194 | + int x = -(MinecraftClient.getInstance().textRenderer |
| 195 | + .getWidth( |
| 196 | + entity.getUuid() == MinecraftClient.getInstance().player.getUuid() |
| 197 | + ? (NickHider.getInstance().hideOwnName.get() |
| 198 | + ? NickHider.getInstance().hiddenNameSelf.get() |
| 199 | + : Team.decorateName(entity.getScoreboardTeam(), entity.getName()) |
| 200 | + .getString()) |
| 201 | + : (NickHider.getInstance().hideOtherNames.get() |
| 202 | + ? NickHider.getInstance().hiddenNameOthers.get() |
| 203 | + : Team.decorateName(entity.getScoreboardTeam(), entity.getName()) |
| 204 | + .getString())) |
| 205 | + / 2 |
| 206 | + + (AxolotlClient.CONFIG.customBadge.get() ? MinecraftClient.getInstance().textRenderer |
| 207 | + .getWidth(" " + Formatting.strip(AxolotlClient.CONFIG.badgeText.get())) : 10)); |
| 208 | + |
| 209 | + RenderSystem.setShaderColor(1, 1, 1, 1); |
| 210 | + |
| 211 | + if (AxolotlClient.CONFIG.customBadge.get()) { |
204 | 212 | Text badgeText = Util.formatFromCodes(AxolotlClient.CONFIG.badgeText.get()); |
205 | | - if(AxolotlClient.CONFIG.useShadows.get()) { |
206 | | - MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, badgeText, x, 0, -1); |
207 | | - } else { |
208 | | - MinecraftClient.getInstance().textRenderer.draw(matrices, badgeText, x, 0, -1); |
209 | | - } |
210 | | - } |
211 | | - else DrawableHelper.drawTexture(matrices, x, 0, 0, 0, 8, 8, 8, 8); |
212 | | - |
213 | | - |
214 | | - } |
215 | | - } |
216 | | - } |
| 213 | + if (AxolotlClient.CONFIG.useShadows.get()) { |
| 214 | + MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, badgeText, x, 0, -1); |
| 215 | + } else { |
| 216 | + MinecraftClient.getInstance().textRenderer.draw(matrices, badgeText, x, 0, -1); |
| 217 | + } |
| 218 | + } else |
| 219 | + DrawableHelper.drawTexture(matrices, x, 0, 0, 0, 8, 8, 8, 8); |
| 220 | + } |
| 221 | + } |
| 222 | + } |
217 | 223 | } |
0 commit comments