merge class-lookup into feature/master

This commit is contained in:
Bella 2020-03-29 19:35:14 -04:00
commit 01ad7a75cd
No known key found for this signature in database
GPG Key ID: 815562EA23BFE344
66 changed files with 362 additions and 295 deletions

View File

@ -3,7 +3,6 @@ package me.zeroeightsix.kami;
import club.minnced.discord.rpc.DiscordEventHandlers;
import club.minnced.discord.rpc.DiscordRPC;
import club.minnced.discord.rpc.DiscordRichPresence;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.misc.DiscordSettings;
import static me.zeroeightsix.kami.KamiMod.APP_ID;
@ -42,7 +41,7 @@ public class DiscordPresence {
while (!Thread.currentThread().isInterrupted()) {
try {
DiscordPresence.rpc.Discord_RunCallbacks();
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordSettings"));
discordSettings = ((DiscordSettings) KamiMod.MODULE_MANAGER.getModule(DiscordSettings.class));
String separator = " | ";
details = discordSettings.getLine(discordSettings.line1Setting.getValue()) + separator + discordSettings.getLine(discordSettings.line3Setting.getValue());
state = discordSettings.getLine(discordSettings.line2Setting.getValue()) + separator + discordSettings.getLine(discordSettings.line4Setting.getValue());
@ -56,7 +55,7 @@ public class DiscordPresence {
}
}
private static void setRpcFromSettings() {
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordSettings"));
discordSettings = ((DiscordSettings) KamiMod.MODULE_MANAGER.getModule(DiscordSettings.class));
details = discordSettings.getLine(discordSettings.line1Setting.getValue()) + " " + discordSettings.getLine(discordSettings.line3Setting.getValue());
state = discordSettings.getLine(discordSettings.line2Setting.getValue()) + " " + discordSettings.getLine(discordSettings.line4Setting.getValue());
DiscordPresence.presence.details = details;

View File

@ -17,6 +17,7 @@ import me.zeroeightsix.kami.gui.rgui.util.ContainerHelper;
import me.zeroeightsix.kami.gui.rgui.util.Docking;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.hidden.RunConfig;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.setting.SettingsRegister;
@ -89,6 +90,7 @@ public class KamiMod {
public static final Logger log = LogManager.getLogger("KAMI Blue");
public static final EventBus EVENT_BUS = new EventManager();
public static final ModuleManager MODULE_MANAGER = new ModuleManager();
@Mod.Instance
private static KamiMod INSTANCE;
@ -163,9 +165,9 @@ public class KamiMod {
public void init(FMLInitializationEvent event) {
KamiMod.log.info("\n\nInitializing " + MODNAME + " " + MODVER);
ModuleManager.initialize();
KamiMod.MODULE_MANAGER.register();
ModuleManager.getModules().stream().filter(module -> module.alwaysListening).forEach(EVENT_BUS::subscribe);
KamiMod.MODULE_MANAGER.getModules().stream().filter(module -> module.alwaysListening).forEach(EVENT_BUS::subscribe);
MinecraftForge.EVENT_BUS.register(new ForgeEventProcessor());
LagCompensator.INSTANCE = new LagCompensator();
@ -182,17 +184,17 @@ public class KamiMod {
KamiMod.log.info("Settings loaded");
// custom names aren't known at compile-time
//ModuleManager.updateLookup(); // generate the lookup table after settings are loaded to make custom module names work
//KamiMod.MODULE_MANAGER.updateLookup(); // generate the lookup table after settings are loaded to make custom module names work
new RichPresence();
KamiMod.log.info("Rich Presence Users init!\n");
// After settings loaded, we want to let the enabled modules know they've been enabled (since the setting is done through reflection)
ModuleManager.getModules().stream().filter(Module::isEnabled).forEach(Module::enable);
KamiMod.MODULE_MANAGER.getModules().stream().filter(Module::isEnabled).forEach(Module::enable);
try { // load modules that are on by default // autoenable
ModuleManager.getModuleByName("Hidden:RunConfig").setEnabled(true);
MODULE_MANAGER.getModule(RunConfig.class).enable();
}
catch (NullPointerException e) {
KamiMod.log.error("NPE in loading always enabled modules\n");
@ -281,7 +283,7 @@ public class KamiMod {
if (!Files.exists(outputFile))
Files.createFile(outputFile);
Configuration.saveConfiguration(outputFile);
ModuleManager.getModules().forEach(Module::destroy);
KamiMod.MODULE_MANAGER.getModules().forEach(Module::destroy);
}
public static boolean isFilenameValid(String file) {

View File

@ -60,7 +60,7 @@ public abstract class Command {
public static void sendDisableMessage(String moduleName) {
sendErrorMessage("Error: The " + moduleName + " module is only for configuring the GUI element. In order to show the GUI element you need to hit the pin in the upper left of the GUI element");
ModuleManager.getModuleByName(moduleName).enable();
KamiMod.MODULE_MANAGER.getModule(moduleName).enable();
}
public static void sendRawChatMessage(String message) {

View File

@ -1,8 +1,8 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.chat.AutoReply;
/**
@ -17,7 +17,7 @@ public class AutoReplyCommand extends Command {
@Override
public void call(String[] args) {
AutoReply autoReply = (AutoReply) ModuleManager.getModuleByName("AutoReply");
AutoReply autoReply = (AutoReply) KamiMod.MODULE_MANAGER.getModule(AutoReply.class);
if (autoReply == null) {
Command.sendErrorMessage("&cThe AutoReply module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
return;

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
@ -54,30 +55,25 @@ public class BindCommand extends Command {
return;
}
Module m = ModuleManager.getModuleByName(module);
if (m == null) {
try {
Module m = KamiMod.MODULE_MANAGER.getModule(module);
if (rkey == null) {
sendChatMessage(m.getName() + " is bound to &b" + m.getBindName());
return;
}
int key = Wrapper.getKey(rkey);
if (rkey.equalsIgnoreCase("none")) {
key = -1;
}
if (key == 0) {
sendChatMessage("Unknown key '" + rkey + "'!");
return;
}
m.getBind().setKey(key);
sendChatMessage("Bind for &b" + m.getName() + "&r set to &b" + rkey.toUpperCase());
} catch (ModuleManager.ModuleNotFoundException x) {
sendChatMessage("Unknown module '" + module + "'!");
return;
}
if (rkey == null) {
sendChatMessage(m.getName() + " is bound to &b" + m.getBindName());
return;
}
int key = Wrapper.getKey(rkey);
if (rkey.equalsIgnoreCase("none")) {
key = -1;
}
if (key == 0) {
sendChatMessage("Unknown key '" + rkey + "'!");
return;
}
m.getBind().setKey(key);
sendChatMessage("Bind for &b" + m.getName() + "&r set to &b" + rkey.toUpperCase());
}
}

View File

@ -1,8 +1,8 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.chat.CustomChat;
/**
@ -17,7 +17,7 @@ public class CustomChatCommand extends Command {
@Override
public void call(String[] args) {
CustomChat cC = (CustomChat) ModuleManager.getModuleByName("CustomChat");
CustomChat cC = (CustomChat) KamiMod.MODULE_MANAGER.getModule(CustomChat.class);
if (cC == null) {
Command.sendErrorMessage("&cThe CustomChat module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
return;

View File

@ -1,9 +1,9 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
/**
* @author S-B99
@ -20,7 +20,7 @@ public class DescriptionCommand extends Command {
for (String s : args) {
if (s == null)
continue;
Module module = ModuleManager.getModuleByName(s);
Module module = KamiMod.MODULE_MANAGER.getModule(s);
Command.sendChatMessage(module.getChatName() + "Description: &7" + module.getDescription());
}
}

View File

@ -3,7 +3,6 @@ package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.chat.DiscordNotifs;
/**
@ -17,7 +16,7 @@ public class DiscordNotifsCommand extends Command {
@Override
public void call(String[] args) {
DiscordNotifs df = (DiscordNotifs) ModuleManager.getModuleByName("DiscordNotifs");
DiscordNotifs df = (DiscordNotifs) KamiMod.MODULE_MANAGER.getModule(DiscordNotifs.class);
if (args[0] != null && !args[0].equals("")) {
df.url.setValue(args[0]);
Command.sendChatMessage(df.getChatName() + "Set URL to \"" + args[0] + "\"!");

View File

@ -1,9 +1,9 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import net.minecraft.util.text.TextFormatting;
import org.apache.commons.lang3.StringUtils;
@ -25,7 +25,10 @@ public class EnabledCommand extends Command {
@Override
public void call(String[] args) {
AtomicReference<String> enabled = new AtomicReference<>("");
List<Module> mods = new ArrayList<>(ModuleManager.getModules());
List<Module> mods = new ArrayList<>(KamiMod.MODULE_MANAGER.getModules());
String f = "";
if (args[0] != null) f = "(filter: " + args[0] + ")";
String f = "";
if (args[0] != null) f = "(filter: " + args[0] + ")";

View File

@ -1,8 +1,8 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.hidden.FixGui;
/**
@ -16,7 +16,7 @@ public class FixGuiCommand extends Command {
@Override
public void call(String[] args) {
FixGui fixGui = (FixGui) ModuleManager.getModuleByName("Hidden:FixGui");
FixGui fixGui = (FixGui) KamiMod.MODULE_MANAGER.getModule(FixGui.class);
if (fixGui.isEnabled()) {
fixGui.disable();
Command.sendChatMessage("[" + getLabel() + "] Disabled");

View File

@ -24,7 +24,7 @@ public class GenerateWebsiteCommand extends Command {
@Override
public void call(String[] args) {
List<Module> mods = new ArrayList<>(ModuleManager.getModules());
List<Module> mods = new ArrayList<>(KamiMod.MODULE_MANAGER.getModules());
String[] modCategories = new String[]{"Chat", "Combat", "Gui", "Misc", "Movement", "Player", "Render", "Utils"};
List<String> modCategoriesList = new ArrayList<>(java.util.Arrays.asList(modCategories));

View File

@ -3,7 +3,7 @@ package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.SyntaxChunk;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.ClickGUI;
import java.util.Arrays;
@ -46,7 +46,7 @@ public class HelpCommand extends Command {
if (args[0] == null) {
Command.sendStringChatMessage(new String[]{
"KAMI Blue " + KamiMod.MODVER,
"&7Press &r" + ModuleManager.getModuleByName("ClickGUI").getBindName() + "&7 to open GUI",
"&7Press &r" + KamiMod.MODULE_MANAGER.getModule(ClickGUI.class).getBindName() + "&7 to open GUI",
"&7see &b" + WEBSITE_LINK + "&7 for a full version of the faq",
commandPrefix + "description&7 to see the description of a module",
commandPrefix + "commands&7 to view all available commands",

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
@ -20,21 +21,21 @@ public class RenameModuleCommand extends Command {
return;
}
Module module = ModuleManager.getModuleByName(args[0]);
if (module == null) {
try {
Module module = KamiMod.MODULE_MANAGER.getModule(args[0]);
String name = args.length == 1 ? module.getOriginalName() : args[1];
if (!(name.matches("[a-zA-Z]+"))) {
sendChatMessage("Name must be alphabetic!");
return;
}
sendChatMessage("&b" + module.getName() + "&r renamed to &b" + name);
module.setName(name);
} catch (ModuleManager.ModuleNotFoundException x) {
sendChatMessage("Unknown module '" + args[0] + "'!");
return;
}
String name = args.length == 1 ? module.getOriginalName() : args[1];
if (!(name.matches("[a-zA-Z]+"))) {
sendChatMessage("Name must be alphabetic!");
return;
}
sendChatMessage("&b" + module.getName() + "&r renamed to &b" + name);
module.setName(name);
}
}

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
@ -33,7 +34,7 @@ public class SetCommand extends Command {
return;
}
Module m = ModuleManager.getModuleByName(args[0]);
Module m = KamiMod.MODULE_MANAGER.getModule(args[0]);
if (m == null) {
Command.sendChatMessage("Unknown module &b" + args[0] + "&r!");
return;

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
@ -28,26 +29,26 @@ public class SettingsCommand extends Command {
return;
}
Module m = ModuleManager.getModuleByName(args[0]);
if (m == null) {
try {
Module m = KamiMod.MODULE_MANAGER.getModule(args[0]);
List<Setting> settings = m.settingList;
String[] result = new String[settings.size()];
for (int i = 0; i < settings.size(); i++) {
Setting setting = settings.get(i);
result[i] = "&b" + setting.getName() + "&3(=" + setting.getValue() + ") &ftype: &3" + setting.getValue().getClass().getSimpleName();
if (setting instanceof EnumSetting) {
result[i] += " (";
Enum[] enums = (Enum[]) ((EnumSetting) setting).clazz.getEnumConstants();
for (Enum e : enums)
result[i] += e.name() + ", ";
result[i] = result[i].substring(0, result[i].length() - 2) + ")";
}
}
Command.sendStringChatMessage(result);
} catch (ModuleManager.ModuleNotFoundException x) {
Command.sendChatMessage("Couldn't find a module &b" + args[0] + "!");
return;
}
List<Setting> settings = m.settingList;
String[] result = new String[settings.size()];
for (int i = 0; i < settings.size(); i++) {
Setting setting = settings.get(i);
result[i] = "&b" + setting.getName() + "&3(=" + setting.getValue() + ") &ftype: &3" + setting.getValue().getClass().getSimpleName();
if (setting instanceof EnumSetting) {
result[i] += " (";
Enum[] enums = (Enum[]) ((EnumSetting) setting).clazz.getEnumConstants();
for (Enum e : enums)
result[i] += e.name() + ", ";
result[i] = result[i].substring(0, result[i].length() - 2) + ")";
}
}
Command.sendStringChatMessage(result);
}
}

View File

@ -1,9 +1,9 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.hidden.Teleport;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.Vec3d;
@ -34,7 +34,7 @@ public class TeleportCommand extends Command {
public void call(String[] args) {
if (args[0].equalsIgnoreCase("stop")) {
Command.sendChatMessage("Teleport Cancelled!");
ModuleManager.getModuleByName("Teleport").disable();
KamiMod.MODULE_MANAGER.getModule(Teleport.class).disable();
return;
}
@ -50,7 +50,7 @@ public class TeleportCommand extends Command {
final double y = args[1].equals("~") ? mc.player.posY : args[1].charAt(0) == '~' ? Double.parseDouble(args[1].substring(1)) + mc.player.posY : Double.parseDouble(args[1]);
final double z = args[2].equals("~") ? mc.player.posZ : args[2].charAt(0) == '~' ? Double.parseDouble(args[2].substring(1)) + mc.player.posZ : Double.parseDouble(args[2]);
Teleport.finalPos = new Vec3d(x, y, z);
ModuleManager.getModuleByName("Teleport").enable();
KamiMod.MODULE_MANAGER.getModule(Teleport.class).enable();
Command.sendChatMessage("\n&aTeleporting to \n&cX: &b" + df.format(x) + "&a, \n&cY: &b" + df.format(y) + "&a, \n&cZ: &b" + df.format(z) + "\n&aat &b" + df.format(Teleport.blocksPerTeleport) + "&c blocks per teleport.");
} catch (NullPointerException e) {
Command.sendErrorMessage("Null Pointer Exception Caught!");

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.command.syntax.parsers.ModuleParser;
@ -24,12 +25,12 @@ public class ToggleCommand extends Command {
Command.sendChatMessage("Please specify a module!");
return;
}
Module m = ModuleManager.getModuleByName(args[0]);
if (m == null) {
try {
Module m = KamiMod.MODULE_MANAGER.getModule(args[0]);
m.toggle();
Command.sendChatMessage(m.getName() + (m.isEnabled() ? " &aenabled" : " &cdisabled"));
} catch (ModuleManager.ModuleNotFoundException x) {
Command.sendChatMessage("Unknown module '" + args[0] + "'");
return;
}
m.toggle();
Command.sendChatMessage(m.getName() + (m.isEnabled() ? " &aenabled" : " &cdisabled"));
}
}

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.commands;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
import me.zeroeightsix.kami.module.ModuleManager;
@ -19,7 +20,7 @@ public class XRayCommand extends Command {
@Override
public void call(String[] args) {
XRay xr = (XRay) ModuleManager.getModuleByName("XRay");
XRay xr = (XRay) KamiMod.MODULE_MANAGER.getModule(XRay.class);
if (xr == null) {
Command.sendErrorMessage("&cThe module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
return;

View File

@ -1,9 +1,9 @@
package me.zeroeightsix.kami.command.syntax.parsers;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.syntax.SyntaxChunk;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
public class ModuleParser extends AbstractParser {
@ -12,7 +12,7 @@ public class ModuleParser extends AbstractParser {
if (chunkValue == null)
return getDefaultChunk(thisChunk);
Module chosen = ModuleManager.getModules().stream()
Module chosen = KamiMod.MODULE_MANAGER.getModules().stream()
.filter(module -> module.getName().toLowerCase().startsWith(chunkValue.toLowerCase()))
.findFirst()
.orElse(null);

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.command.syntax.parsers;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.syntax.SyntaxChunk;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
@ -10,7 +11,7 @@ import java.util.TreeMap;
public class ValueParser extends AbstractParser {
int moduleIndex;
private int moduleIndex;
public ValueParser(int moduleIndex) {
this.moduleIndex = moduleIndex;
@ -19,20 +20,23 @@ public class ValueParser extends AbstractParser {
public String getChunk(SyntaxChunk[] chunks, SyntaxChunk thisChunk, String[] values, String chunkValue) {
if (moduleIndex > values.length - 1 || chunkValue == null) return getDefaultChunk(thisChunk);
String module = values[moduleIndex];
Module m = ModuleManager.getModuleByName(module);
if (m == null) return "";
try {
Module m = KamiMod.MODULE_MANAGER.getModule(module);
HashMap<String, Setting<?>> possibilities = new HashMap<>();
HashMap<String, Setting> possibilities = new HashMap<>();
for (Setting<?> v : m.settingList) {
if (v.getName().toLowerCase().startsWith(chunkValue.toLowerCase()))
possibilities.put(v.getName(), v);
}
for (Setting v : m.settingList) {
if (v.getName().toLowerCase().startsWith(chunkValue.toLowerCase()))
possibilities.put(v.getName(), v);
if (possibilities.isEmpty()) return "";
TreeMap<String, Setting<?>> p = new TreeMap<>(possibilities);
Setting<?> aV = p.firstEntry().getValue();
return aV.getName().substring(chunkValue.length());
} catch (ModuleManager.ModuleNotFoundException x) {
return "";
}
if (possibilities.isEmpty()) return "";
TreeMap<String, Setting> p = new TreeMap<>(possibilities);
Setting aV = p.firstEntry().getValue();
return aV.getName().substring(chunkValue.length());
}
}

View File

@ -7,7 +7,6 @@ import me.zeroeightsix.kami.event.events.DisplaySizeChangedEvent;
import me.zeroeightsix.kami.gui.UIRenderer;
import me.zeroeightsix.kami.gui.kami.KamiGUI;
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.CommandConfig;
import me.zeroeightsix.kami.module.modules.render.BossStack;
import me.zeroeightsix.kami.util.KamiTessellator;
@ -71,19 +70,19 @@ public class ForgeEventProcessor {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (Wrapper.getPlayer() == null) return;
ModuleManager.onUpdate();
KamiMod.MODULE_MANAGER.onUpdate();
KamiMod.getInstance().getGuiManager().callTick(KamiMod.getInstance().getGuiManager());
}
@SubscribeEvent
public void onWorldRender(RenderWorldLastEvent event) {
if (event.isCanceled()) return;
ModuleManager.onWorldRender(event);
KamiMod.MODULE_MANAGER.onWorldRender(event);
}
@SubscribeEvent
public void onRenderPre(RenderGameOverlayEvent.Pre event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.BOSSINFO && ModuleManager.isModuleEnabled("BossStack")) {
if (event.getType() == RenderGameOverlayEvent.ElementType.BOSSINFO && KamiMod.MODULE_MANAGER.isModuleEnabled(BossStack.class)) {
event.setCanceled(true);
}
}
@ -97,12 +96,12 @@ public class ForgeEventProcessor {
target = RenderGameOverlayEvent.ElementType.HEALTHMOUNT;
if (event.getType() == target) {
ModuleManager.onRender();
KamiMod.MODULE_MANAGER.onRender();
GL11.glPushMatrix();
UIRenderer.renderAndUpdateFrames();
GL11.glPopMatrix();
KamiTessellator.releaseGL();
} else if (event.getType() == RenderGameOverlayEvent.ElementType.BOSSINFO && ModuleManager.isModuleEnabled("BossStack")) {
} else if (event.getType() == RenderGameOverlayEvent.ElementType.BOSSINFO && KamiMod.MODULE_MANAGER.isModuleEnabled(BossStack.class)) {
BossStack.render(event);
}
}
@ -110,10 +109,14 @@ public class ForgeEventProcessor {
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (!Keyboard.getEventKeyState()) return;
if (((CommandConfig) ModuleManager.getModuleByName("CommandConfig")).prefixChat.getValue() && ("" + Keyboard.getEventCharacter()).equalsIgnoreCase(Command.getCommandPrefix()) && !(Minecraft.getMinecraft().player.isSneaking())) {
CommandConfig commandConfig = (CommandConfig) KamiMod.MODULE_MANAGER.getModule(CommandConfig.class);
if ( commandConfig.isEnabled()
&& (commandConfig.prefixChat.getValue())
&& ("" + Keyboard.getEventCharacter()).equalsIgnoreCase(Command.getCommandPrefix())
&& !(Minecraft.getMinecraft().player.isSneaking())) {
Minecraft.getMinecraft().displayGuiScreen(new GuiChat(Command.getCommandPrefix()));
} else {
ModuleManager.onBind(Keyboard.getEventKey());
KamiMod.MODULE_MANAGER.onBind(Keyboard.getEventKey());
}
}

View File

@ -3,7 +3,7 @@ package me.zeroeightsix.kami.gui.kami;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.gui.rgui.component.Component;
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.ClickGUI;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@ -94,11 +94,10 @@ public class DisplayGuiScreen extends GuiScreen {
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (ModuleManager.getModuleByName("clickGUI").getBind().isDown(keyCode) || keyCode == Keyboard.KEY_ESCAPE) {
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (KamiMod.MODULE_MANAGER.getModule(ClickGUI.class).getBind().isDown(keyCode) || keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(lastScreen);
}
else {
} else {
gui.handleKeyDown(keyCode);
gui.handleKeyUp(keyCode);
}

View File

@ -15,7 +15,6 @@ import me.zeroeightsix.kami.gui.rgui.render.theme.Theme;
import me.zeroeightsix.kami.gui.rgui.util.ContainerHelper;
import me.zeroeightsix.kami.gui.rgui.util.Docking;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.InfoOverlay;
import me.zeroeightsix.kami.util.ColourHolder;
import me.zeroeightsix.kami.util.Friends;
@ -65,7 +64,7 @@ public class KamiGUI extends GUI {
@Override
public void initializeGUI() {
HashMap<Module.Category, Pair<Scrollpane, SettingsPanel>> categoryScrollpaneHashMap = new HashMap<>();
for (Module module : ModuleManager.getModules()) {
for (Module module : KamiMod.MODULE_MANAGER.getModules()) {
if (module.getCategory().isHidden()) continue;
Module.Category moduleCategory = module.getCategory();
if (!categoryScrollpaneHashMap.containsKey(moduleCategory)) {
@ -235,7 +234,7 @@ public class KamiGUI extends GUI {
Label information = new Label("");
information.setShadow(true);
information.addTickListener(() -> {
InfoOverlay info = (InfoOverlay) ModuleManager.getModuleByName("InfoOverlay");
InfoOverlay info = ((InfoOverlay) KamiMod.MODULE_MANAGER.getModule(InfoOverlay.class));;
information.setText("");
info.infoContents().forEach(information::addLine);
});

View File

@ -1,10 +1,10 @@
package me.zeroeightsix.kami.gui.kami.component;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.gui.rgui.component.AbstractComponent;
import me.zeroeightsix.kami.gui.rgui.component.Component;
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -32,8 +32,7 @@ public class TabGUI extends AbstractComponent implements EventListener {
for (Module.Category category : Module.Category.values())
tabMap.put(category, new Tab(category.getName()));
ArrayList<Module> features = new ArrayList<>();
features.addAll(ModuleManager.getModules());
ArrayList<Module> features = new ArrayList<>(KamiMod.MODULE_MANAGER.getModules());
for (Module feature : features)
if (feature.getCategory() != null && !feature.getCategory().isHidden())

View File

@ -1,11 +1,9 @@
package me.zeroeightsix.kami.gui.kami.theme.kami;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.gui.rgui.render.AbstractComponentUI;
import me.zeroeightsix.kami.gui.rgui.render.font.FontRenderer;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.ActiveModules;
import me.zeroeightsix.kami.util.Wrapper;
import org.lwjgl.opengl.GL11;
@ -33,14 +31,14 @@ public class KamiActiveModulesUI extends AbstractComponentUI<me.zeroeightsix.kam
GL11.glEnable(GL11.GL_TEXTURE_2D);
FontRenderer renderer = Wrapper.getFontRenderer();
List<Module> mods = ModuleManager.getModules().stream()
List<Module> mods = KamiMod.MODULE_MANAGER.getModules().stream()
.filter(Module::isEnabled)
.filter(Module::isOnArray)
.sorted(Comparator.comparing(module -> renderer.getStringWidth(module.getName() + (module.getHudInfo() == null ? "" : module.getHudInfo() + " ")) * (component.sort_up ? -1 : 1)))
.collect(Collectors.toList());
final int[] y = {2};
activeMods = (ActiveModules) ModuleManager.getModuleByName("ActiveModules");
activeMods = (ActiveModules) KamiMod.MODULE_MANAGER.getModule(ActiveModules.class);
if (component.getParent().getY() < 26 && Wrapper.getPlayer().getActivePotionEffects().size() > 0 && component.getParent().getOpacity() == 0)
y[0] = Math.max(component.getParent().getY(), 26 - component.getParent().getY());

View File

@ -1,10 +1,10 @@
package me.zeroeightsix.kami.gui.kami.theme.kami;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.gui.kami.RenderHelper;
import me.zeroeightsix.kami.gui.kami.component.SettingsPanel;
import me.zeroeightsix.kami.gui.rgui.render.AbstractComponentUI;
import me.zeroeightsix.kami.gui.rgui.render.font.FontRenderer;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.experimental.GUIColour;
import org.lwjgl.opengl.GL11;
@ -18,11 +18,11 @@ public class KamiSettingsPanelUI extends AbstractComponentUI<SettingsPanel> {
super.renderComponent(component, fontRenderer);
GL11.glLineWidth(2.0F);
float red = (float) ((GUIColour) ModuleManager.getModuleByName("GUI Colour")).red.getValue() / 255.0F;
float green = (float) ((GUIColour) ModuleManager.getModuleByName("GUI Colour")).green.getValue() / 255.0F;
float blue = (float) ((GUIColour) ModuleManager.getModuleByName("GUI Colour")).blue.getValue() / 255.0F;
float alpha = (float) ((GUIColour) ModuleManager.getModuleByName("GUI Colour")).alpha.getValue() / 255.0F;
if (ModuleManager.getModuleByName("GUI Colour").isEnabled()) {
float red = (float) (Integer) ((GUIColour) KamiMod.MODULE_MANAGER.getModule(GUIColour.class)).red.getValue() / 255.0F;
float green = (float) (Integer) ((GUIColour) KamiMod.MODULE_MANAGER.getModule(GUIColour.class)).green.getValue() / 255.0F;
float blue = (float) (Integer) ((GUIColour) KamiMod.MODULE_MANAGER.getModule(GUIColour.class)).blue.getValue() / 255.0F;
float alpha = (float) (Integer) ((GUIColour) KamiMod.MODULE_MANAGER.getModule(GUIColour.class)).alpha.getValue() / 255.0F;
if (KamiMod.MODULE_MANAGER.getModule(GUIColour.class).isEnabled()) {
GL11.glColor4f(red, green, blue, alpha);
} else {
GL11.glColor4f(0.17F, 0.17F, 0.18F, 0.9F);

View File

@ -1,7 +1,8 @@
package me.zeroeightsix.kami.mixin;
import me.zeroeightsix.kami.KamiMod;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;
@ -10,14 +11,16 @@ import java.util.Map;
public class MixinLoaderForge implements IFMLLoadingPlugin {
/* This is NOT using KamiMod, as importing it causes the issue described here: https://github.com/SpongePowered/Mixin/issues/388 */
public static final Logger log = LogManager.getLogger("KAMI Blue");
private static boolean isObfuscatedEnvironment = false;
public MixinLoaderForge() {
KamiMod.log.info("KAMI mixins initialized");
log.info("KAMI mixins initialized");
MixinBootstrap.init();
Mixins.addConfiguration("mixins.kami.json");
MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge");
KamiMod.log.info(MixinEnvironment.getDefaultEnvironment().getObfuscationContext());
log.info(MixinEnvironment.getDefaultEnvironment().getObfuscationContext());
}
@Override

View File

@ -1,6 +1,8 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.movement.Velocity;
import me.zeroeightsix.kami.module.modules.player.LiquidInteract;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
@ -21,8 +23,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public class MixinBlockLiquid {
@Inject(method = "modifyAcceleration", at = @At("HEAD"), cancellable = true)
public void modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3d motion, CallbackInfoReturnable returnable) {
if (ModuleManager.isModuleEnabled("Velocity")) {
public void modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3d motion, CallbackInfoReturnable<Vec3d> returnable) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Velocity.class)) {
returnable.setReturnValue(motion);
returnable.cancel();
}
@ -30,6 +32,6 @@ public class MixinBlockLiquid {
@Inject(method = "canCollideCheck", at = @At("HEAD"), cancellable = true)
public void canCollideCheck(final IBlockState blockState, final boolean b, final CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
callbackInfoReturnable.setReturnValue(ModuleManager.isModuleEnabled("LiquidInteract") || (b && (int) blockState.getValue((IProperty) BlockLiquid.LEVEL) == 0));
callbackInfoReturnable.setReturnValue(KamiMod.MODULE_MANAGER.isModuleEnabled(LiquidInteract.class) || (b && (int) blockState.getValue((IProperty) BlockLiquid.LEVEL) == 0));
}
}

View File

@ -1,6 +1,6 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.movement.NoSlowDown;
import net.minecraft.block.BlockSoulSand;
import net.minecraft.block.state.IBlockState;
@ -21,7 +21,7 @@ public class MixinBlockSoulSand {
@Inject(method = "onEntityCollision", at = @At("HEAD"), cancellable = true)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn, CallbackInfo info) {
// If noslowdown is on, just don't do anything else in this method (slow the player)
if (ModuleManager.isModuleEnabled("NoSlowDown") && ((NoSlowDown) ModuleManager.getModuleByName("NoSlowDown")).soulSand.getValue()) info.cancel();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoSlowDown.class) && ((NoSlowDown) KamiMod.MODULE_MANAGER.getModule(NoSlowDown.class)).soulSand.getValue()) info.cancel();
}
}

View File

@ -1,6 +1,6 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.movement.NoSlowDown;
import net.minecraft.block.BlockWeb;
import net.minecraft.block.state.IBlockState;
@ -22,7 +22,7 @@ public class MixinBlockWeb {
@Inject(method = "onEntityCollision", at = @At("HEAD"), cancellable = true)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn, CallbackInfo info) {
// If noslowdown is on, just don't do anything else in this method (slow the player)
if (ModuleManager.isModuleEnabled("NoSlowDown") && ((NoSlowDown) ModuleManager.getModuleByName("NoSlowDown")).cobweb.getValue()) info.cancel();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoSlowDown.class) && ((NoSlowDown) KamiMod.MODULE_MANAGER.getModule(NoSlowDown.class)).cobweb.getValue()) info.cancel();
}
}

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.misc.FakeVanillaClient;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.handshake.client.C00Handshake;
@ -27,7 +28,7 @@ public class MixinC00Handshake {
@Inject(method = "writePacketData", at = @At(value = "HEAD"), cancellable = true)
public void writePacketData(PacketBuffer buf, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("FakeVanillaClient")) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(FakeVanillaClient.class)) {
info.cancel();
buf.writeVarInt(protocolVersion);
buf.writeString(ip);

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.render.XRay;
import net.minecraft.block.state.IBlockState;
@ -22,7 +23,7 @@ public class MixinChunkCache {
@Inject(method = "getBlockState", at = @At("RETURN"), cancellable = true)
public void getState(BlockPos pos, CallbackInfoReturnable<IBlockState> info) {
if (ModuleManager.isModuleEnabled("XRay"))
if (KamiMod.MODULE_MANAGER.isModuleEnabled(XRay.class))
info.setReturnValue(XRay.transform(info.getReturnValue()));
}

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.movement.EntitySpeed;
import net.minecraft.entity.passive.EntityLlama;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -15,7 +16,7 @@ public class MixinEntityLlama {
@Inject(method = "canBeSteered", at = @At("RETURN"), cancellable = true)
public void canBeSteered(CallbackInfoReturnable<Boolean> returnable) {
if (ModuleManager.isModuleEnabled("EntitySpeed")) returnable.setReturnValue(true);
if (KamiMod.MODULE_MANAGER.isModuleEnabled(EntitySpeed.class)) returnable.setReturnValue(true);
}
}

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.movement.EntitySpeed;
import net.minecraft.entity.passive.EntityPig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -14,8 +15,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public class MixinEntityPig {
@Inject(method = "canBeSteered", at = @At("HEAD"), cancellable = true)
public void canBeSteered(CallbackInfoReturnable returnable) {
if (ModuleManager.isModuleEnabled("EntitySpeed")) {
public void canBeSteered(CallbackInfoReturnable<Boolean> returnable) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(EntitySpeed.class)) {
returnable.setReturnValue(true);
returnable.cancel();
}

View File

@ -3,7 +3,8 @@ package me.zeroeightsix.kami.mixin.client;
import com.mojang.authlib.GameProfile;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.events.PlayerMoveEvent;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.chat.PortalChat;
import me.zeroeightsix.kami.module.modules.misc.BeaconSelector;
import me.zeroeightsix.kami.util.BeaconGui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
@ -29,14 +30,16 @@ public abstract class MixinEntityPlayerSP extends EntityPlayer {
super(worldIn, gameProfileIn);
}
@SuppressWarnings("UnnecessaryReturnStatement")
@Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;closeScreen()V"))
public void closeScreen(EntityPlayerSP entityPlayerSP) {
if (ModuleManager.isModuleEnabled("PortalChat")) return;
if (KamiMod.MODULE_MANAGER.isModuleEnabled(PortalChat.class)) return;
}
@SuppressWarnings("UnnecessaryReturnStatement")
@Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V"))
public void closeScreen(Minecraft minecraft, GuiScreen screen) {
if (ModuleManager.isModuleEnabled("PortalChat")) return;
if (KamiMod.MODULE_MANAGER.isModuleEnabled(PortalChat.class)) return;
}
/**
@ -44,7 +47,7 @@ public abstract class MixinEntityPlayerSP extends EntityPlayer {
*/
@Inject(method = "displayGUIChest", at = @At("HEAD"), cancellable = true)
public void onDisplayGUIChest(IInventory chestInventory, CallbackInfo ci) {
if (ModuleManager.getModuleByName("BeaconSelector").isEnabled()) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(BeaconSelector.class)) {
if (chestInventory instanceof IInteractionObject) {
if ("minecraft:beacon".equals(((IInteractionObject)chestInventory).getGuiID())) {
Minecraft.getMinecraft().displayGuiScreen(new BeaconGui(this.inventory, chestInventory));

View File

@ -1,14 +1,16 @@
package me.zeroeightsix.kami.mixin.client;
import com.google.common.base.Predicate;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.misc.CameraClip;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.module.modules.player.NoEntityTrace;
import me.zeroeightsix.kami.module.modules.render.AntiFog;
import me.zeroeightsix.kami.module.modules.render.Brightness;
import me.zeroeightsix.kami.module.modules.render.NoHurtCam;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.EntityRenderer;
@ -39,7 +41,7 @@ public class MixinEntityRenderer {
@Redirect(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;rayTraceBlocks(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;"))
public RayTraceResult rayTraceBlocks(WorldClient world, Vec3d start, Vec3d end) {
if (ModuleManager.isModuleEnabled("CameraClip"))
if (KamiMod.MODULE_MANAGER.isModuleEnabled(CameraClip.class))
return null;
else
return world.rayTraceBlocks(start, end);
@ -85,7 +87,7 @@ public class MixinEntityRenderer {
public boolean noclipIsSpectator(AbstractClientPlayer acp) {
// [WebringOfTheDamned]
// Freecam doesn't actually use spectator mode, but it can go through walls, and only spectator mode is "allowed to" go through walls as far as the renderer is concerned
if (ModuleManager.isModuleEnabled("Freecam"))
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class))
return true;
return acp.isSpectator();
}

View File

@ -1,8 +1,9 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import net.minecraft.util.math.AxisAlignedBB;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.util.math.AxisAlignedBB;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -19,7 +20,7 @@ public abstract class MixinFrustum {
// [WebringOfTheDamned]
// This is used because honestly the Mojang frustrum bounding box thing is a mess.
// This & MixinEntityRenderer get it working on OptiFine, but MixinVisGraph is necessary on Vanilla.
if (ModuleManager.isModuleEnabled("Freecam"))
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class))
info.setReturnValue(true);
}

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.CleanGUI;
import me.zeroeightsix.kami.module.modules.render.ShulkerPreview;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
@ -18,6 +18,8 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static me.zeroeightsix.kami.KamiMod.MODULE_MANAGER;
/**
* Created by 086 on 24/12/2017.
*/
@ -30,7 +32,7 @@ public class MixinGuiScreen {
@Inject(method = "renderToolTip", at = @At("HEAD"), cancellable = true)
public void renderToolTip(ItemStack stack, int x, int y, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("ShulkerPreview") && stack.getItem() instanceof ItemShulkerBox) {
if (MODULE_MANAGER.isModuleEnabled(ShulkerPreview.class) && stack.getItem() instanceof ItemShulkerBox) {
NBTTagCompound tagCompound = stack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("BlockEntityTag", 10)) {
NBTTagCompound blockEntityTag = tagCompound.getCompoundTag("BlockEntityTag");
@ -104,7 +106,7 @@ public class MixinGuiScreen {
*/
@Inject(method = "Lnet/minecraft/client/gui/GuiScreen;drawWorldBackground(I)V", at = @At("HEAD"), cancellable = true)
private void drawWorldBackgroundWrapper(final int tint, final CallbackInfo ci) {
if (mc.world != null && ModuleManager.isModuleEnabled("CleanGUI") && (((CleanGUI) ModuleManager.getModuleByName("CleanGUI")).inventoryGlobal.getValue())) {
if (this.mc.world != null && MODULE_MANAGER.isModuleEnabled(CleanGUI.class) && (((CleanGUI) MODULE_MANAGER.getModule(CleanGUI.class)).inventoryGlobal.getValue())) {
ci.cancel();
}
}

View File

@ -27,19 +27,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinMinecraft {
@Shadow
WorldClient world;
public WorldClient world;
@Shadow
EntityPlayerSP player;
public EntityPlayerSP player;
@Shadow
GuiScreen currentScreen;
public GuiScreen currentScreen;
@Shadow
GameSettings gameSettings;
public GameSettings gameSettings;
@Shadow
GuiIngame ingameGUI;
public GuiIngame ingameGUI;
@Shadow
boolean skipRenderWorld;
public boolean skipRenderWorld;
@Shadow
SoundHandler soundHandler;
public SoundHandler soundHandler;
@Inject(method = "displayGuiScreen", at = @At("HEAD"), cancellable = true)
public void displayGuiScreen(GuiScreen guiScreenIn, CallbackInfo info) {

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.movement.EntitySpeed;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.client.model.ModelBoat;
import net.minecraft.client.renderer.GlStateManager;
@ -19,7 +19,7 @@ public class MixinModelBoat {
@Inject(method = "render", at = @At("HEAD"))
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale, CallbackInfo info) {
if (Wrapper.getPlayer().getRidingEntity() == entityIn && ModuleManager.isModuleEnabled("EntitySpeed")) {
if (Wrapper.getPlayer().getRidingEntity() == entityIn && KamiMod.MODULE_MANAGER.isModuleEnabled(EntitySpeed.class)) {
GlStateManager.color(1, 1, 1, EntitySpeed.getOpacity());
GlStateManager.enableBlend();
}

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.render.Chams;
import me.zeroeightsix.kami.KamiMod;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -19,7 +19,7 @@ public class MixinRenderLiving {
@Inject(method = "doRender", at = @At("HEAD"))
private void injectChamsPre(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("Chams") && Chams.renderChams(entity)) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Chams.class) && Chams.renderChams(entity)) {
GL11.glEnable(32823);
GL11.glPolygonOffset(1.0f, -1000000.0f);
}
@ -27,7 +27,7 @@ public class MixinRenderLiving {
@Inject(method = "doRender", at = @At("RETURN"))
private <S extends EntityLivingBase> void injectChamsPost(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("Chams") && Chams.renderChams(entity)) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Chams.class) && Chams.renderChams(entity)) {
GL11.glPolygonOffset(1.0f, 1000000.0f);
GL11.glDisable(32823);
}

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.render.Nametags;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.RenderPlayer;
import org.spongepowered.asm.mixin.Mixin;
@ -16,7 +17,7 @@ public class MixinRenderPlayer {
@Inject(method = "renderEntityName", at = @At("HEAD"), cancellable = true)
public void renderLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String name, double distanceSq, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("Nametags")) info.cancel();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Nametags.class)) info.cancel();
}
}

View File

@ -1,17 +1,17 @@
package me.zeroeightsix.kami.mixin.client;
import java.util.EnumSet;
import java.util.Set;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import net.minecraft.client.renderer.chunk.VisGraph;
import net.minecraft.util.EnumFacing;
import me.zeroeightsix.kami.module.ModuleManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.EnumSet;
import java.util.Set;
/**
* Created by 20kdc on 14/02/2020, but really 15/02/2020 because this is basically being recycled
*/
@ -23,7 +23,7 @@ public class MixinVisGraph {
// WebringOfTheDamned
// This part prevents the "block-level culling". OptiFine does this for you but vanilla doesn't.
// We have to implement this here or else OptiFine causes trouble.
if (ModuleManager.isModuleEnabled("Freecam"))
if (KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class))
callbackInfo.setReturnValue(EnumSet.<EnumFacing>allOf(EnumFacing.class));
}

View File

@ -18,29 +18,25 @@ import java.util.*;
/**
* Created by 086 on 23/08/2017.
* Updated by Sasha
*/
public class ModuleManager {
public static ArrayList<Module> modules = new ArrayList<>();
/**
* Linked map for the registered Modules
*/
private Map<Class<? extends Module>, Module> modules = new LinkedHashMap<>();
/**
* Lookup map for getting by **original** name
* Registers modules, and then calls updateLookup() for indexing.
*/
static HashMap<String, Integer> lookup = new HashMap<>();
public static void updateLookup() {
lookup.clear();
for (int i = 0; i < modules.size(); i++) {
lookup.put(modules.get(i).getOriginalName().toLowerCase(), i);
}
}
public static void initialize() {
public void register() {
KamiMod.log.info("Registering modules...");
Set<Class> classList = ClassFinder.findClasses(ClickGUI.class.getPackage().getName(), Module.class);
classList.forEach(aClass -> {
classList.stream().sorted(Comparator.comparing(Class::getSimpleName)).forEach(aClass -> {
try {
Module module = (Module) aClass.getConstructor().newInstance();
modules.add(module);
modules.put(module.getClass(), module);
} catch (InvocationTargetException e) {
e.getCause().printStackTrace();
System.err.println("Couldn't initiate module " + aClass.getSimpleName() + "! Err: " + e.getClass().getSimpleName() + ", message: " + e.getMessage());
@ -49,20 +45,23 @@ public class ModuleManager {
System.err.println("Couldn't initiate module " + aClass.getSimpleName() + "! Err: " + e.getClass().getSimpleName() + ", message: " + e.getMessage());
}
});
KamiMod.log.info("Modules initialised");
getModules().sort(Comparator.comparing(Module::getOriginalName));
updateLookup();
KamiMod.log.info("Modules registered");
}
public static void onUpdate() {
modules.stream().filter(module -> module.alwaysListening || module.isEnabled()).forEach(Module::onUpdate);
public void onUpdate() {
modules.forEach((clazz, mod) -> {
if (mod.alwaysListening || mod.isEnabled()) mod.onUpdate();
});
//modules.stream().filter(module -> module.alwaysListening || module.isEnabled()).forEach(Module::onUpdate);
}
public static void onRender() {
modules.stream().filter(module -> module.alwaysListening || module.isEnabled()).forEach(Module::onRender);
public void onRender() {
modules.forEach((clazz, mod) -> {
if (mod.alwaysListening || mod.isEnabled()) mod.onRender();
});
}
public static void onWorldRender(RenderWorldLastEvent event) {
public void onWorldRender(RenderWorldLastEvent event) {
Minecraft.getMinecraft().profiler.startSection("kami");
Minecraft.getMinecraft().profiler.startSection("setup");
@ -81,10 +80,12 @@ public class ModuleManager {
e.resetTranslation();
Minecraft.getMinecraft().profiler.endSection();
modules.stream().filter(module -> module.alwaysListening || module.isEnabled()).forEach(module -> {
Minecraft.getMinecraft().profiler.startSection(module.getOriginalName());
module.onWorldRender(e);
Minecraft.getMinecraft().profiler.endSection();
modules.forEach((clazz, mod) -> {
if (mod.alwaysListening || mod.isEnabled()) {
Minecraft.getMinecraft().profiler.startSection(mod.getOriginalName());
mod.onWorldRender(e);
Minecraft.getMinecraft().profiler.endSection();
}
});
Minecraft.getMinecraft().profiler.startSection("release");
@ -101,31 +102,50 @@ public class ModuleManager {
Minecraft.getMinecraft().profiler.endSection();
}
public static void onBind(int eventKey) {
public void onBind(int eventKey) {
if (eventKey == 0) return; // if key is the 'none' key (stuff like mod key in i3 might return 0)
modules.forEach(module -> {
modules.forEach((clazz, module) -> {
if (module.getBind().isDown(eventKey)) {
module.toggle();
}
});
}
public static ArrayList<Module> getModules() {
return modules;
public Collection<Module> getModules() {
return Collections.unmodifiableCollection(this.modules.values());
}
public Module getModule(Class<? extends Module> clazz) {
return modules.get(clazz);
}
public static Module getModuleByName(String name) {
Integer index = lookup.get(name.toLowerCase());
if (index == null) {
throw new IllegalArgumentException("getModuleByName() failed. Are you calling this too early? Is the module spelled correctly? Please check!!!!");
/**
* @deprecated Use `getModule(Class<? extends Module>)` instead
*/
@Deprecated
public Module getModule(String name) {
for (Map.Entry<Class<? extends Module>, Module> module : modules.entrySet()) {
if (module.getClass().getSimpleName().equalsIgnoreCase(name) || module.getValue().getOriginalName().equalsIgnoreCase(name)) {
return module.getValue();
}
}
return modules.get(index);
throw new ModuleNotFoundException("getModuleByName(String) failed. Check spelling.");
}
public static boolean isModuleEnabled(String moduleName) {
Module m = getModuleByName(moduleName);
if (m == null) return false;
return m.isEnabled();
public boolean isModuleEnabled(Class<? extends Module> clazz) {
return getModule(clazz).isEnabled();
}
@Deprecated
public boolean isModuleEnabled(String moduleName) {
return getModule(moduleName).isEnabled();
}
public static class ModuleNotFoundException extends IllegalArgumentException {
public ModuleNotFoundException(String s) {
super(s);
}
}
}

View File

@ -11,7 +11,6 @@ import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.event.events.ServerConnectedEvent;
import me.zeroeightsix.kami.event.events.ServerDisconnectedEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.InfoOverlay;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -140,8 +139,8 @@ public class DiscordNotifs extends Module {
}
private String getTime() {
if (!time.getValue() || ModuleManager.getModuleByName("ChatTimestamp").isEnabled()) return "";
InfoOverlay info = (InfoOverlay) ModuleManager.getModuleByName("InfoOverlay");
if (!time.getValue() || KamiMod.MODULE_MANAGER.isModuleEnabled(ChatTimestamp.class)) return "";
InfoOverlay info = (InfoOverlay) KamiMod.MODULE_MANAGER.getModule(InfoOverlay.class);
return "[" + TimeUtil.getFinalTime(info.timeUnitSetting.getValue(), info.timeTypeSetting.getValue(), info.doLocale.getValue()) + "] ";
}

View File

@ -2,9 +2,9 @@ package me.zeroeightsix.kami.module.modules.combat;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.entity.Entity;
@ -41,7 +41,7 @@ public class AntiChainPop extends Module {
});
public void onUpdate() {
if (mc.player == null) disable();
if (mc.player == null) return;
if (mode.getValue().equals(Mode.ITEMS)) {
itemMode();
}
@ -50,7 +50,7 @@ public class AntiChainPop extends Module {
private void itemMode() {
int old = totems;
if (getItems(Items.TOTEM_OF_UNDYING) < old) {
Surround surround = (Surround) ModuleManager.getModuleByName("Surround");
Surround surround = (Surround) KamiMod.MODULE_MANAGER.getModule(Surround.class);
surround.autoDisable.setValue(true);
surround.enable();
}
@ -58,7 +58,7 @@ public class AntiChainPop extends Module {
}
private void packetMode() {
Surround surround = (Surround) ModuleManager.getModuleByName("Surround");
Surround surround = (Surround) KamiMod.MODULE_MANAGER.getModule(Surround.class);
surround.autoDisable.setValue(true);
surround.enable();
}

View File

@ -1,8 +1,8 @@
package me.zeroeightsix.kami.module.modules.combat;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.misc.AutoTool;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -142,7 +142,7 @@ public class Aura extends Module {
// We want to skip this if switchTo32k.getValue() is true,
// because it only accounts for tools and weapons.
// Maybe someone could refactor this later? :3
if ((!switchMode.getValue().equals(SwitchMode.ONLY32K) || switchMode.getValue().equals(SwitchMode.ALL)) && ModuleManager.isModuleEnabled("AutoTool")) {
if ((!switchMode.getValue().equals(SwitchMode.ONLY32K) || switchMode.getValue().equals(SwitchMode.ALL)) && KamiMod.MODULE_MANAGER.isModuleEnabled(AutoTool.class)) {
AutoTool.equipBestWeapon();
}
attack(target);

View File

@ -4,7 +4,6 @@ import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.event.events.GuiScreenEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.client.gui.GuiGameOver;
@ -64,10 +63,9 @@ public class AutoEZ extends Module {
@Override
public void onUpdate() {
if (hasBeenCombat > 0 && (focus.getHealth() <= 0.0f || focus.isDead || !mc.world.playerEntities.contains(this.focus))) {
if (ModuleManager.getModuleByName("AutoEZ").isEnabled()) {
mc.player.sendChatMessage(getText(mode.getValue())+focus.getName());
}
if (mc.player == null) return;
if (hasBeenCombat > 0 && (focus.getHealth() <= 0.0f || focus.isDead || !mc.world.playerEntities.contains(focus))) {
mc.player.sendChatMessage(getText(mode.getValue())+focus.getName());
hasBeenCombat = 0;
}
--hasBeenCombat;

View File

@ -1,9 +1,10 @@
package me.zeroeightsix.kami.module.modules.combat;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.module.modules.player.NoBreakAnimation;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -107,7 +108,8 @@ public class AutoFeetPlace extends Module {
@Override
public void onUpdate() {
if (mc.player == null || ModuleManager.isModuleEnabled("Freecam")) {
if (mc.player == null || KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) {
return;
}
@ -244,8 +246,8 @@ public class AutoFeetPlace extends Module {
mc.player.swingArm(EnumHand.MAIN_HAND);
mc.rightClickDelayTimer = 4;
if (ModuleManager.getModuleByName("NoBreakAnimation").isEnabled()) {
((NoBreakAnimation) ModuleManager.getModuleByName("NoBreakAnimation")).resetMining();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoBreakAnimation.class)) {
((NoBreakAnimation) KamiMod.MODULE_MANAGER.getModule(NoBreakAnimation.class)).resetMining();
}
return true;
}

View File

@ -2,8 +2,9 @@ package me.zeroeightsix.kami.module.modules.combat;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.misc.AutoReconnect;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.client.Minecraft;
@ -53,7 +54,7 @@ public class AutoLog extends Module {
}
private void log() {
ModuleManager.getModuleByName("AutoReconnect").disable();
KamiMod.MODULE_MANAGER.getModule(AutoReconnect.class).disable();
shouldLog = true;
lastLog = System.currentTimeMillis();
}

View File

@ -1,9 +1,11 @@
package me.zeroeightsix.kami.module.modules.combat;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.module.modules.player.NoBreakAnimation;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -117,7 +119,7 @@ public class AutoTrap extends Module {
public void onUpdate() {
if (mc.player == null || mc.player.getHealth() <= 0) return;
if (!activeInFreecam.getValue() && ModuleManager.isModuleEnabled("Freecam")) return;
if (!activeInFreecam.getValue() && KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) return;
if (firstRun) {
if (findObiInHotbar() == -1) {
@ -259,8 +261,8 @@ public class AutoTrap extends Module {
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, neighbour, opposite));
}
if (ModuleManager.getModuleByName("NoBreakAnimation").isEnabled()) {
((NoBreakAnimation) ModuleManager.getModuleByName("NoBreakAnimation")).resetMining();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoBreakAnimation.class)) {
((NoBreakAnimation) KamiMod.MODULE_MANAGER.getModule(NoBreakAnimation.class)).resetMining();
}
return true;
}

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.module.modules.combat;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.event.events.RenderEvent;
@ -221,7 +222,7 @@ public class CrystalAura extends Module {
explode(crystal);
}
if (sneakEnable.getValue() && mc.player.isSneaking() && holeBlocks != 5) {
ModuleManager.getModuleByName("Surround").enable();
KamiMod.MODULE_MANAGER.getModule(Surround.class).enable();
}
return;
}

View File

@ -2,10 +2,9 @@ package me.zeroeightsix.kami.module.modules.combat;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.entity.item.EntityEnderCrystal;
@ -14,6 +13,9 @@ import net.minecraft.inventory.ClickType;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import java.util.Comparator;
import java.util.Objects;
import static me.zeroeightsix.kami.module.modules.gui.InfoOverlay.getItems;
import java.util.Comparator;
@ -53,9 +55,9 @@ public class OffhandGap extends Module {
return;
}
if (mc.player.getHeldItemMainhand().getItem() instanceof ItemSword || mc.player.getHeldItemMainhand().getItem() instanceof ItemAxe || passItemCheck()) {
if (ModuleManager.isModuleEnabled("AutoOffhand")) {
if (KamiMod.MODULE_MANAGER.isModuleEnabled(AutoOffhand.class)) {
autoTotemWasEnabled = true;
ModuleManager.getModuleByName("AutoOffhand").disable();
KamiMod.MODULE_MANAGER.getModule(AutoOffhand.class).disable();
}
if (!eatWhileAttacking.getValue()) { /* Save item for later when using preventDesync */
usedItem = mc.player.getHeldItemMainhand().getItem();
@ -78,7 +80,8 @@ public class OffhandGap extends Module {
disableGaps();
}
/* Disable if there are crystals in the range of CrystalAura */
else if (crystalCheck.getValue() && crystalAura.isEnabled()) {
crystalAura = (CrystalAura) KamiMod.MODULE_MANAGER.getModule(CrystalAura.class);
if (crystalCheck.getValue() && crystalAura.isEnabled()) {
EntityEnderCrystal crystal = mc.world.loadedEntityList.stream()
.filter(entity -> entity instanceof EntityEnderCrystal)
.map(entity -> (EntityEnderCrystal) entity)
@ -135,9 +138,9 @@ public class OffhandGap extends Module {
}
private void disableGaps() {
if (autoTotemWasEnabled != ModuleManager.isModuleEnabled("AutoOffhand")) {
if (autoTotemWasEnabled != KamiMod.MODULE_MANAGER.isModuleEnabled(AutoOffhand.class)) {
moveGapsToInventory(gaps);
ModuleManager.getModuleByName("AutoOffhand").enable();
KamiMod.MODULE_MANAGER.getModule(AutoOffhand.class).enable();
autoTotemWasEnabled = false;
}
}

View File

@ -1,8 +1,9 @@
package me.zeroeightsix.kami.module.modules.combat;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.module.modules.player.NoBreakAnimation;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -59,7 +60,7 @@ public class Surround extends Module {
}
public void onUpdate() {
if (!isDisabled() && mc.player != null && !ModuleManager.isModuleEnabled("Freecam")) {
if (!this.isDisabled() && mc.player != null && !KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) {
if (offsetStep == 0) {
basePos = (new BlockPos(mc.player.getPositionVector())).down();
playerHotbarSlot = mc.player.inventory.currentItem;
@ -199,8 +200,8 @@ public class Surround extends Module {
if (placeAnimation.getValue()) mc.player.connection.sendPacket(new CPacketAnimation(mc.player.getActiveHand()));
placeBlockExecute(blockPos);
}
if (ModuleManager.getModuleByName("NoBreakAnimation").isEnabled()) {
((NoBreakAnimation) ModuleManager.getModuleByName("NoBreakAnimation")).resetMining();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoBreakAnimation.class)) {
((NoBreakAnimation) KamiMod.MODULE_MANAGER.getModule(NoBreakAnimation.class)).resetMining();
}
}

View File

@ -2,10 +2,10 @@ package me.zeroeightsix.kami.module.modules.experimental;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.combat.CrystalAura;
import me.zeroeightsix.kami.module.modules.player.NoBreakAnimation;
import me.zeroeightsix.kami.setting.Setting;
@ -17,7 +17,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockObsidian;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -94,7 +93,7 @@ public class HoleFiller extends Module {
entities.addAll(mc.world.playerEntities.stream().filter(entityPlayer -> !Friends.isFriend(entityPlayer.getName())).collect(Collectors.toList()));
int range = (int) Math.ceil(distance.getValue());
CrystalAura ca = (CrystalAura) ModuleManager.getModuleByName("CrystalAura");
CrystalAura ca = (CrystalAura) KamiMod.MODULE_MANAGER.getModule(CrystalAura.class);
blockPosList = ca.getSphere(getPlayerPos(), range, range, false, true, 0);
for (Entity p : entities) {
List<BlockPos> maybe = ca.getSphere(p.getPosition(), range, range, false, true, 0);
@ -160,8 +159,8 @@ public class HoleFiller extends Module {
mc.player.connection.sendPacket(new CPacketHeldItemChange(obiSlot));
lookAtPacket(p.x, p.y, p.z, mc.player);
BlockInteractionHelper.placeBlockScaffold(p);
if (ModuleManager.getModuleByName("NoBreakAnimation").isEnabled()) {
((NoBreakAnimation) ModuleManager.getModuleByName("NoBreakAnimation")).resetMining();
if (KamiMod.MODULE_MANAGER.isModuleEnabled(NoBreakAnimation.class)) {
((NoBreakAnimation) KamiMod.MODULE_MANAGER.getModule(NoBreakAnimation.class)).resetMining();
}
resetRotation();
mc.player.connection.sendPacket(new CPacketHeldItemChange(oldSlot));

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.module.modules.gui;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
@ -76,7 +77,7 @@ public class ActiveModules extends Module {
}
private TextFormatting infoGetSetting(boolean isOne) {
InfoOverlay infoOverlay = (InfoOverlay) ModuleManager.getModuleByName("InfoOverlay");
InfoOverlay infoOverlay = (InfoOverlay) KamiMod.MODULE_MANAGER.getModule(InfoOverlay.class);
if (isOne) return setToText(infoOverlay.firstColour.getValue());
else return setToText(infoOverlay.secondColour.getValue());

View File

@ -1,9 +1,11 @@
package me.zeroeightsix.kami.module.modules.hidden;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.combat.Aura;
import me.zeroeightsix.kami.module.modules.combat.CrystalAura;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.Friends;
@ -28,7 +30,10 @@ import net.minecraft.util.math.Vec3d;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPos;
import static me.zeroeightsix.kami.util.BlockInteractionHelper.*;
@ -44,7 +49,7 @@ public class Auto32k extends Module {
private Setting<Boolean> moveToHotbar = register(Settings.b("Move 32k to Hotbar", true));
private Setting<Boolean> autoEnableHitAura = register(Settings.b("Auto enable Hit Aura", true));
//private Setting<Double> placeRange = register(Settings.d("Place Range", 4.0d));
private Setting<Double> placeRange = this.register(Settings.doubleBuilder("Place range").withMinimum(1.0).withValue(4.0).withMaximum(10.0).build());
private Setting<Double> placeRange = register(Settings.doubleBuilder("Place range").withMinimum(1.0).withValue(4.0).withMaximum(10.0).build());
private Setting<Integer> yOffset = register(Settings.i("Y Offset (Hopper)", 2));
private Setting<Boolean> placeCloseToEnemy = register(Settings.b("Place close to enemy", false));
private Setting<Boolean> placeObiOnTop = register(Settings.b("Place Obi on Top", true));
@ -56,7 +61,7 @@ public class Auto32k extends Module {
@Override
protected void onEnable() {
if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) {
if (isDisabled() || mc.player == null || KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) {
disable();
return;
}
@ -110,7 +115,7 @@ public class Auto32k extends Module {
int range = (int) Math.ceil(placeRange.getValue());
CrystalAura crystalAura = (CrystalAura) ModuleManager.getModuleByName("CrystalAura");
CrystalAura crystalAura = (CrystalAura) KamiMod.MODULE_MANAGER.getModule(CrystalAura.class);
List<BlockPos> placeTargetList = crystalAura.getSphere(getPlayerPos(), range, range, false, true, 0);
Map<BlockPos, Double> placeTargetMap = new HashMap<>();
@ -233,7 +238,7 @@ public class Auto32k extends Module {
@Override
public void onUpdate() {
if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) {
if (isDisabled() || mc.player == null || KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) {
return;
}
@ -263,7 +268,7 @@ public class Auto32k extends Module {
if (swapReady) {
mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, 0, swordSlot - 32, ClickType.SWAP, mc.player);
if (autoEnableHitAura.getValue()) {
ModuleManager.getModuleByName("Aura").enable();
KamiMod.MODULE_MANAGER.getModule(Aura.class).enable();
}
disable();
}
@ -372,7 +377,7 @@ public class Auto32k extends Module {
//@Override
//protected void onDisable() {
// if (autoEnableHitAura.getValue()) {
// ModuleManager.getModuleByName("Aura").disable();
// KamiMod.MODULE_MANAGER.getModuleByName("Aura").disable();
// }
//}

View File

@ -1,7 +1,15 @@
package me.zeroeightsix.kami.module.modules.hidden;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.capes.Capes;
import me.zeroeightsix.kami.module.modules.chat.CustomChat;
import me.zeroeightsix.kami.module.modules.gui.ActiveModules;
import me.zeroeightsix.kami.module.modules.gui.CommandConfig;
import me.zeroeightsix.kami.module.modules.gui.InfoOverlay;
import me.zeroeightsix.kami.module.modules.gui.InventoryViewer;
import me.zeroeightsix.kami.module.modules.misc.DiscordSettings;
import me.zeroeightsix.kami.module.modules.render.TabFriends;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -18,29 +26,29 @@ public class RunConfig extends Module {
private Setting<Boolean> hasRunCustomChat = register(Settings.b("CustomChat", false));
public void onEnable() {
ModuleManager.getModuleByName("InfoOverlay").setEnabled(true);
ModuleManager.getModuleByName("ActiveModules").setEnabled(true);
ModuleManager.getModuleByName("InventoryViewer").setEnabled(true);
ModuleManager.getModuleByName("CommandConfig").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(InfoOverlay.class).enable();
KamiMod.MODULE_MANAGER.getModule(ActiveModules.class).enable();
KamiMod.MODULE_MANAGER.getModule(InventoryViewer.class).enable();
KamiMod.MODULE_MANAGER.getModule(CommandConfig.class).enable();
if (!hasRunCapes.getValue()) {
ModuleManager.getModuleByName("Capes").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(Capes.class).enable();
hasRunCapes.setValue(true);
}
if (!hasRunDiscordSettings.getValue()) {
ModuleManager.getModuleByName("DiscordSettings").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(DiscordSettings.class).enable();
hasRunDiscordSettings.setValue(true);
}
if (!hasRunFixGui.getValue()) {
ModuleManager.getModuleByName("Hidden:FixGui").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(FixGui.class).enable();
hasRunFixGui.setValue(true);
}
if (!hasRunTabFriends.getValue()) {
ModuleManager.getModuleByName("TabFriends").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(TabFriends.class).enable();
hasRunTabFriends.setValue(true);
}
if (!hasRunCustomChat.getValue()) {
ModuleManager.getModuleByName("CustomChat").setEnabled(true);
KamiMod.MODULE_MANAGER.getModule(CustomChat.class).enable();
hasRunCustomChat.setValue(true);
}
disable();

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.module.modules.misc;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
@ -392,7 +393,7 @@ public class AutoSpawner extends Module {
return;
}
CrystalAura crystalAura = (CrystalAura) ModuleManager.getModuleByName("CrystalAura");
CrystalAura crystalAura = (CrystalAura) KamiMod.MODULE_MANAGER.getModule(CrystalAura.class);
List<BlockPos> blockPosList = crystalAura.getSphere(mc.player.getPosition().down(), placeRange.getValue(), placeRange.getValue().intValue(), false, true, 0);
boolean noPositionInArea = true;

View File

@ -2,8 +2,8 @@ package me.zeroeightsix.kami.module.modules.movement;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.render.Pathfind;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -34,7 +34,7 @@ public class AutoWalk extends Module {
event.getMovementInput().moveForward = 1;
if (mc.player.isInWater() || mc.player.isInLava()) mc.player.movementInput.jump = true;
else if (mc.player.collidedHorizontally && mc.player.onGround) mc.player.jump();
if (!ModuleManager.isModuleEnabled("Pathfind") || Pathfind.points.isEmpty()) return;
if (!KamiMod.MODULE_MANAGER.isModuleEnabled(Pathfind.class) || Pathfind.points.isEmpty()) return;
PathPoint next = Pathfind.points.get(0);
lookAt(next);
break;

View File

@ -2,11 +2,12 @@ package me.zeroeightsix.kami.module.modules.movement;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.KamiEvent;
import me.zeroeightsix.kami.event.events.AddCollisionBoxToListEvent;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.player.Freecam;
import me.zeroeightsix.kami.util.EntityUtil;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.block.BlockLiquid;
@ -27,7 +28,7 @@ public class Jesus extends Module {
@Override
public void onUpdate() {
if (!ModuleManager.isModuleEnabled("Freecam")) {
if (!KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) {
if (EntityUtil.isInWater(mc.player) && !mc.player.isSneaking()) {
mc.player.motionY = 0.1;
if (mc.player.getRidingEntity() != null && !(mc.player.getRidingEntity() instanceof EntityBoat)) {

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.module.modules.movement;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
/**
* Created by 086 on 23/08/2017.
@ -13,7 +13,7 @@ public class Sprint extends Module {
@Override
public void onUpdate() {
if (mc.player == null) return;
if (ModuleManager.getModuleByName("ElytraFlight").isEnabled() && (mc.player.isElytraFlying() || mc.player.capabilities.isFlying)) return;
if (KamiMod.MODULE_MANAGER.getModule(ElytraFlight.class).isEnabled() && (mc.player.isElytraFlying() || mc.player.capabilities.isFlying)) return;
try {
if (!mc.player.collidedHorizontally && mc.player.moveForward > 0)
mc.player.setSprinting(true);

View File

@ -2,8 +2,8 @@ package me.zeroeightsix.kami.module.modules.player;
import me.zero.alpine.listener.EventHandler;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.EntityUtil;
@ -68,7 +68,7 @@ public class Scaffold extends Module {
@Override
public void onUpdate() {
if (mc.player == null || ModuleManager.isModuleEnabled("Freecam")) return;
if (mc.player == null || KamiMod.MODULE_MANAGER.isModuleEnabled(Freecam.class)) return;
shouldSlow = false;
Vec3d vec3d = EntityUtil.getInterpolatedPos(mc.player, ticks.getValue());

View File

@ -1,8 +1,8 @@
package me.zeroeightsix.kami.module.modules.render;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.event.events.RenderEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.combat.CrystalAura;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -76,7 +76,7 @@ public class HoleESP extends Module {
int range = (int) Math.ceil(renderDistance.getValue());
CrystalAura crystalAura = (CrystalAura) ModuleManager.getModuleByName("CrystalAura");
CrystalAura crystalAura = (CrystalAura) KamiMod.MODULE_MANAGER.getModule(CrystalAura.class);
List<BlockPos> blockPosList = crystalAura.getSphere(getPlayerPos(), range, range, false, true, 0);
for (BlockPos pos : blockPosList) {

View File

@ -1,7 +1,7 @@
package me.zeroeightsix.kami.util;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.module.modules.gui.CommandConfig;
/**
@ -9,7 +9,7 @@ import me.zeroeightsix.kami.module.modules.gui.CommandConfig;
*/
public class CommandUtil {
public static void runAliases(Command command) {
if (!((CommandConfig) ModuleManager.getModuleByName("CommandConfig")).aliasInfo.getValue()) return;
if (!((CommandConfig) KamiMod.MODULE_MANAGER.getModule(CommandConfig.class)).aliasInfo.getValue()) return;
int amount = command.getAliases().size();
if (amount > 0) {
Command.sendChatMessage("'" + command.getLabel() + "' has " + grammar1(amount) + "alias" + grammar2(amount));

View File

@ -1,6 +1,5 @@
package me.zeroeightsix.kami.util;
import me.zeroeightsix.kami.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
@ -45,6 +44,7 @@ public class InfoCalculator {
// Speed {
private static DecimalFormat formatter = new DecimalFormat("#.#");
public static String speed(boolean useUnitKmH, Minecraft mc) {
float currentTps = mc.timer.tickLength / 1000.0f;
double multiply = 1.0;
@ -114,6 +114,7 @@ public class InfoCalculator {
// Dimension {
public static String playerDimension(Minecraft mc) {
if (mc.player == null) return "No Dimension";
switch(mc.player.dimension) {
case -1:
return "Nether";