From 8a3cc808093e5fa1e87558a45386f0cbdf0f3145 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Wed, 1 Mar 2023 12:41:53 +0100 Subject: chore: renamed BoSCoVicino to Boscovicino --- src/main/java/ftbsc/bscv/BoSCoVicino.java | 178 --------------------- src/main/java/ftbsc/bscv/Boscovicino.java | 177 ++++++++++++++++++++ .../java/ftbsc/bscv/modules/AbstractModule.java | 9 +- src/main/java/ftbsc/bscv/modules/QuickModule.java | 7 +- src/main/java/ftbsc/bscv/modules/defense/Aura.java | 4 +- .../java/ftbsc/bscv/modules/hud/ActiveModules.java | 8 +- .../java/ftbsc/bscv/modules/hud/Coordinates.java | 10 +- .../java/ftbsc/bscv/modules/hud/EntityList.java | 21 ++- .../java/ftbsc/bscv/modules/hud/InfoDisplay.java | 16 +- .../java/ftbsc/bscv/modules/hud/PlayerList.java | 12 +- .../ftbsc/bscv/modules/motion/VanillaFlight.java | 13 +- .../java/ftbsc/bscv/modules/self/AntiHunger.java | 6 +- .../ftbsc/bscv/modules/self/AutoDisconnect.java | 7 +- .../java/ftbsc/bscv/modules/self/AutoFish.java | 4 +- .../java/ftbsc/bscv/modules/self/AutoTool.java | 8 +- .../java/ftbsc/bscv/modules/self/FastInteract.java | 19 +-- src/main/java/ftbsc/bscv/modules/self/Freecam.java | 15 +- .../java/ftbsc/bscv/modules/self/PortalGui.java | 4 +- .../java/ftbsc/bscv/modules/vision/Fullbright.java | 4 +- src/main/java/ftbsc/bscv/patches/BoatPatch.java | 17 +- src/main/java/ftbsc/bscv/patches/PacketPatch.java | 19 +-- src/main/java/ftbsc/bscv/tools/Inventory.java | 6 +- src/main/java/ftbsc/bscv/tools/Setting.java | 15 +- src/main/java/ftbsc/bscv/tools/Text.java | 1 - 24 files changed, 262 insertions(+), 318 deletions(-) delete mode 100644 src/main/java/ftbsc/bscv/BoSCoVicino.java create mode 100644 src/main/java/ftbsc/bscv/Boscovicino.java (limited to 'src/main/java/ftbsc') diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java deleted file mode 100644 index 117544c..0000000 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ /dev/null @@ -1,178 +0,0 @@ -package ftbsc.bscv; - -import ftbsc.bscv.api.IModule; -import ftbsc.bscv.system.ModManager; -import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.client.gui.screen.IngameMenuScreen; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.command.CommandSource; -import net.minecraft.command.Commands; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraftforge.client.event.ClientChatEvent; -import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig.Type; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.exceptions.CommandSyntaxException; - -import java.lang.reflect.Field; - -@Mod("bscv") -public class BoSCoVicino implements ICommons { - public static String MOD_ID = "bscv"; - - public static final Logger LOGGER = LogManager.getLogger(); - - public static ModManager modManager; //todo this should not be static - - private final CommandDispatcher dispatcher = new CommandDispatcher<>(); - - public static ForgeConfigSpec spec; - - public BoSCoVicino() { - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); - - ForgeConfigSpec.Builder cfg = new ForgeConfigSpec.Builder(); - CommandDispatcher dp = this.dispatcher; - - BoSCoVicino.modManager = new ModManager(cfg, dp); - BoSCoVicino.modManager.load(); - - BoSCoVicino.spec = cfg.build(); - - // register config handler - ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml"); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - } - - public static void log(String message) { - LOGGER.info(message); - if (MC.player != null) { - MC.player.displayClientMessage(new StringTextComponent(message), true); - } - } - - private void clientSetup(final FMLClientSetupEvent event) { - LOGGER.info("Initializing modules"); - - for (IModule m : modManager.mods) { - if (m.isEnabled()) m.enable(); - } - - // TEMPORARY! add command to regenerate suggestions - dispatcher.register( - Commands.literal("hints") - .executes(ctx -> { - ClientPlayerEntity player = MC.player; - if (player != null) { - try { - Field commands = player.connection.getClass().getDeclaredField("field_195517_n"); // "commands", it's obfuscated - commands.setAccessible(true); - commands.set(player.connection, this.dispatcher); - LOGGER.info("Rebuild HINTS"); - log("> rebuilt hints"); - return 1; - } catch (NoSuchFieldException e) { - log("! no such field error"); - LOGGER.error("No such field Exception while rebuilding hints"); - return 0; - } catch (IllegalAccessException e) { - log("! illegal access error"); - LOGGER.error("Illegal Access Exception while rebuilding hints"); - return 0; - } - } else { - log("! local player is NULL"); - LOGGER.error("Local player is NULL"); - return 0; - } - }) - ); - - dispatcher.register( - Commands.literal("toggle-all") - .executes(ctx -> { - for (IModule mod : modManager.mods) { - if (mod.isEnabled()) { - mod.disable(); - mod.enable(); - } - } - return 1; - }) - ); - } - - @SubscribeEvent - public void onClientChatEvent(ClientChatEvent event) { - if (event.getMessage().startsWith("/")) { - CommandSource source = MC.player.createCommandSourceStack(); // TODO player could be NULL - try { - LOGGER.info(String.format("Running command %s", event.getMessage())); - this.dispatcher.execute(event.getMessage().substring(1), source); - MC.gui.getChat().addRecentChat(event.getMessage()); - event.setCanceled(true); - } catch (CommandSyntaxException e) { - LOGGER.error(String.format("Syntax error in command : %s", e.toString())); - } - } - } - - @SubscribeEvent - public void onPauseMenu(InitGuiEvent.Post event) { - if (event.getGui() instanceof IngameMenuScreen) { // TODO de-jank this, maybe by extending IngameMenuScreen - IngameMenuScreen screen = (IngameMenuScreen) event.getGui(); - screen.buttons.remove(3); - screen.buttons.remove(3); - screen.children.remove(3); - screen.children.remove(3); - Button mods_btn = new Button( - screen.width / 2 + 4, - screen.height / 4 + 72 + -16, 98, 20, - new TranslationTextComponent("fml.menu.mods"), - cb -> { - MC.setScreen(new net.minecraftforge.fml.client.gui.screen.ModListScreen(screen)); - } - ); - // need to add it twice for it to work once... - screen.buttons.add(3, mods_btn); - screen.buttons.add(3, mods_btn); - screen.children.add(3, mods_btn); - screen.children.add(3, mods_btn); - } - } - - @SubscribeEvent - public void onWorldLoad(WorldEvent.Load event) { - // TEMPORARY! add command to regenerate suggestions - ClientPlayerEntity player = MC.player; - if (player != null) { - try { - Field commands = player.connection.getClass().getDeclaredField("field_195517_n"); // "commands", it's obfuscated - commands.setAccessible(true); - commands.set(player.connection, this.dispatcher); - LOGGER.info("Rebuild HINTS"); - log("> rebuilt hints"); - } catch (NoSuchFieldException e) { - LOGGER.error("No such field Exception while rebuilding hints"); - } catch (IllegalAccessException e) { - LOGGER.error("Illegal Access Exception while rebuilding hints"); - } - } else { - LOGGER.error("Local player is NULL"); - } - } -} diff --git a/src/main/java/ftbsc/bscv/Boscovicino.java b/src/main/java/ftbsc/bscv/Boscovicino.java new file mode 100644 index 0000000..f5e4f93 --- /dev/null +++ b/src/main/java/ftbsc/bscv/Boscovicino.java @@ -0,0 +1,177 @@ +package ftbsc.bscv; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import ftbsc.bscv.api.IModule; +import ftbsc.bscv.system.ModManager; +import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.gui.screen.IngameMenuScreen; +import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.command.CommandSource; +import net.minecraft.command.Commands; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.client.event.ClientChatEvent; +import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig.Type; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.lang.reflect.Field; + +@Mod("bscv") +public class Boscovicino implements ICommons { + public static String MOD_ID = "bscv"; + + public static final Logger LOGGER = LogManager.getLogger(); + + public static ModManager modManager; //todo this should not be static + + private final CommandDispatcher dispatcher = new CommandDispatcher<>(); + + public static ForgeConfigSpec spec; + + public Boscovicino() { + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); + + ForgeConfigSpec.Builder cfg = new ForgeConfigSpec.Builder(); + CommandDispatcher dp = this.dispatcher; + + Boscovicino.modManager = new ModManager(cfg, dp); + Boscovicino.modManager.load(); + + Boscovicino.spec = cfg.build(); + + // register config handler + ModLoadingContext.get().registerConfig(Type.CLIENT, spec, "bscv.toml"); + + // Register ourselves for server and other game events we are interested in + MinecraftForge.EVENT_BUS.register(this); + } + + public static void log(String message) { + LOGGER.info(message); + if (MC.player != null) { + MC.player.displayClientMessage(new StringTextComponent(message), true); + } + } + + private void clientSetup(final FMLClientSetupEvent event) { + LOGGER.info("Initializing modules"); + + for (IModule m : modManager.mods) { + if (m.isEnabled()) m.enable(); + } + + // TEMPORARY! add command to regenerate suggestions + dispatcher.register( + Commands.literal("hints") + .executes(ctx -> { + ClientPlayerEntity player = MC.player; + if (player != null) { + try { + Field commands = player.connection.getClass().getDeclaredField("field_195517_n"); // "commands", it's obfuscated + commands.setAccessible(true); + commands.set(player.connection, this.dispatcher); + LOGGER.info("Rebuild HINTS"); + log("> rebuilt hints"); + return 1; + } catch (NoSuchFieldException e) { + log("! no such field error"); + LOGGER.error("No such field Exception while rebuilding hints"); + return 0; + } catch (IllegalAccessException e) { + log("! illegal access error"); + LOGGER.error("Illegal Access Exception while rebuilding hints"); + return 0; + } + } else { + log("! local player is NULL"); + LOGGER.error("Local player is NULL"); + return 0; + } + }) + ); + + dispatcher.register( + Commands.literal("toggle-all") + .executes(ctx -> { + for (IModule mod : modManager.mods) { + if (mod.isEnabled()) { + mod.disable(); + mod.enable(); + } + } + return 1; + }) + ); + } + + @SubscribeEvent + public void onClientChatEvent(ClientChatEvent event) { + if (event.getMessage().startsWith("/")) { + CommandSource source = MC.player.createCommandSourceStack(); // TODO player could be NULL + try { + LOGGER.info(String.format("Running command %s", event.getMessage())); + this.dispatcher.execute(event.getMessage().substring(1), source); + MC.gui.getChat().addRecentChat(event.getMessage()); + event.setCanceled(true); + } catch (CommandSyntaxException e) { + LOGGER.error(String.format("Syntax error in command : %s", e.toString())); + } + } + } + + @SubscribeEvent + public void onPauseMenu(InitGuiEvent.Post event) { + if (event.getGui() instanceof IngameMenuScreen) { // TODO de-jank this, maybe by extending IngameMenuScreen + IngameMenuScreen screen = (IngameMenuScreen) event.getGui(); + screen.buttons.remove(3); + screen.buttons.remove(3); + screen.children.remove(3); + screen.children.remove(3); + Button mods_btn = new Button( + screen.width / 2 + 4, + screen.height / 4 + 72 + -16, 98, 20, + new TranslationTextComponent("fml.menu.mods"), + cb -> { + MC.setScreen(new net.minecraftforge.fml.client.gui.screen.ModListScreen(screen)); + } + ); + // need to add it twice for it to work once... + screen.buttons.add(3, mods_btn); + screen.buttons.add(3, mods_btn); + screen.children.add(3, mods_btn); + screen.children.add(3, mods_btn); + } + } + + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + // TEMPORARY! add command to regenerate suggestions + ClientPlayerEntity player = MC.player; + if (player != null) { + try { + Field commands = player.connection.getClass().getDeclaredField("field_195517_n"); // "commands", it's obfuscated + commands.setAccessible(true); + commands.set(player.connection, this.dispatcher); + LOGGER.info("Rebuild HINTS"); + log("> rebuilt hints"); + } catch (NoSuchFieldException e) { + LOGGER.error("No such field Exception while rebuilding hints"); + } catch (IllegalAccessException e) { + LOGGER.error("Illegal Access Exception while rebuilding hints"); + } + } else { + LOGGER.error("Local player is NULL"); + } + } +} diff --git a/src/main/java/ftbsc/bscv/modules/AbstractModule.java b/src/main/java/ftbsc/bscv/modules/AbstractModule.java index dc785f9..fcf4363 100644 --- a/src/main/java/ftbsc/bscv/modules/AbstractModule.java +++ b/src/main/java/ftbsc/bscv/modules/AbstractModule.java @@ -2,15 +2,14 @@ package ftbsc.bscv.modules; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.BoolArgumentType; - -import ftbsc.bscv.BoSCoVicino; +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.api.IModule; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.MinecraftForge; -import static ftbsc.bscv.BoSCoVicino.log; +import static ftbsc.bscv.Boscovicino.log; public abstract class AbstractModule implements IModule { protected ForgeConfigSpec.ConfigValue enabled; @@ -28,12 +27,12 @@ public abstract class AbstractModule implements IModule { @Override public ForgeConfigSpec.Builder getConfigBuilder() { - return BoSCoVicino.modManager.getCfgBuilder(); + return Boscovicino.modManager.getCfgBuilder(); } @Override public CommandDispatcher getDispatcher() { - return BoSCoVicino.modManager.getDispatcher(); + return Boscovicino.modManager.getDispatcher(); } public AbstractModule() { diff --git a/src/main/java/ftbsc/bscv/modules/QuickModule.java b/src/main/java/ftbsc/bscv/modules/QuickModule.java index a2e989b..311b205 100644 --- a/src/main/java/ftbsc/bscv/modules/QuickModule.java +++ b/src/main/java/ftbsc/bscv/modules/QuickModule.java @@ -1,5 +1,6 @@ package ftbsc.bscv.modules; +import ftbsc.bscv.Boscovicino; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.util.InputMappings; import net.minecraftforge.client.event.InputEvent; @@ -7,8 +8,6 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; -import ftbsc.bscv.BoSCoVicino; - // TODO rename public abstract class QuickModule extends AbstractModule { @@ -78,11 +77,11 @@ public abstract class QuickModule extends AbstractModule { } private static String key_name(String name) { - return String.format("key.%s.%s", BoSCoVicino.MOD_ID, name); + return String.format("key.%s.%s", Boscovicino.MOD_ID, name); } private static String key_category() { - return String.format("key.category.%s", BoSCoVicino.MOD_ID); + return String.format("key.category.%s", Boscovicino.MOD_ID); } } diff --git a/src/main/java/ftbsc/bscv/modules/defense/Aura.java b/src/main/java/ftbsc/bscv/modules/defense/Aura.java index 7ffb2f5..36ff8cd 100644 --- a/src/main/java/ftbsc/bscv/modules/defense/Aura.java +++ b/src/main/java/ftbsc/bscv/modules/defense/Aura.java @@ -1,6 +1,8 @@ package ftbsc.bscv.modules.defense; +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.tools.Setting; import net.minecraft.entity.Entity; @@ -9,8 +11,6 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class Aura extends QuickModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java index 213eb54..e2e14cf 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java +++ b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java @@ -1,7 +1,9 @@ package ftbsc.bscv.modules.hud; -import ftbsc.bscv.BoSCoVicino; +import com.google.auto.service.AutoService; +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.api.IModule; import ftbsc.bscv.modules.HudModule; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -9,8 +11,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.eventbus.api.SubscribeEvent; import static ftbsc.bscv.tools.Text.TextBuilder; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class ActiveModules extends HudModule implements ICommons { @@ -18,7 +18,7 @@ public class ActiveModules extends HudModule implements ICommons { public void onRenderOverlay(RenderGameOverlayEvent event) { if (event.getType() == ElementType.TEXT) { int offset = 0; - for (IModule m : BoSCoVicino.modManager.mods) { + for (IModule m : Boscovicino.modManager.mods) { if (m.isEnabled() && !m.getGroup().equalsIgnoreCase("HUD")) { TextBuilder() .txt(String.format("%s <", m.getName())) diff --git a/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java b/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java index 44c8756..b33726f 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java +++ b/src/main/java/ftbsc/bscv/modules/hud/Coordinates.java @@ -1,5 +1,9 @@ package ftbsc.bscv.modules.hud; +import com.google.auto.service.AutoService; +import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; +import ftbsc.bscv.modules.HudModule; import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; @@ -7,12 +11,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import static ftbsc.bscv.tools.Text.TextBuilder; -import com.google.auto.service.AutoService; - -import ftbsc.bscv.ICommons; -import ftbsc.bscv.modules.HudModule; -import ftbsc.bscv.api.ILoadable; - @AutoService(ILoadable.class) public class Coordinates extends HudModule implements ICommons { @SubscribeEvent diff --git a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java index 288f2a7..fcb2132 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/EntityList.java +++ b/src/main/java/ftbsc/bscv/modules/hud/EntityList.java @@ -1,18 +1,10 @@ package ftbsc.bscv.modules.hud; -import static ftbsc.bscv.tools.Text.TextBuilder; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import com.mojang.brigadier.CommandDispatcher; - +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.HudModule; import ftbsc.bscv.tools.Setting; -import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; import net.minecraft.util.text.Color; import net.minecraft.util.text.Style; @@ -21,8 +13,13 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static ftbsc.bscv.tools.Text.TextBuilder; @AutoService(ILoadable.class) public class EntityList extends HudModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java index f232c70..42d94b4 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java +++ b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java @@ -1,16 +1,10 @@ package ftbsc.bscv.modules.hud; -import static ftbsc.bscv.tools.Text.TextBuilder; - -import java.util.ArrayDeque; - -import com.mojang.brigadier.CommandDispatcher; - +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.HudModule; import ftbsc.bscv.tools.Setting; -import net.minecraft.client.Minecraft; -import net.minecraft.command.CommandSource; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.Color; import net.minecraft.util.text.Style; @@ -20,8 +14,10 @@ import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; + +import java.util.ArrayDeque; + +import static ftbsc.bscv.tools.Text.TextBuilder; @AutoService(ILoadable.class) public class InfoDisplay extends HudModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java b/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java index 00839f9..6558388 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java +++ b/src/main/java/ftbsc/bscv/modules/hud/PlayerList.java @@ -1,20 +1,16 @@ package ftbsc.bscv.modules.hud; -import static ftbsc.bscv.tools.Text.TextBuilder; - -import com.mojang.brigadier.CommandDispatcher; - +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.HudModule; -import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; + +import static ftbsc.bscv.tools.Text.TextBuilder; @AutoService(ILoadable.class) public class PlayerList extends HudModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java index 1cc4c2c..9853595 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java +++ b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java @@ -1,21 +1,18 @@ package ftbsc.bscv.modules.motion; -import com.mojang.brigadier.CommandDispatcher; - -import ftbsc.bscv.BoSCoVicino; +import com.google.auto.service.AutoService; +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.tools.Setting; import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.command.CommandSource; import net.minecraft.network.play.client.CPlayerPacket; import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class VanillaFlight extends QuickModule implements ICommons { @@ -88,7 +85,7 @@ public class VanillaFlight extends QuickModule implements ICommons { this.tick = ( this.tick + 1 ) % this.antikick_cycle.get(); if (this.tick == 0) { Vector3d pos = MC.player.position(); - BoSCoVicino.log("[*] antikick"); + Boscovicino.log("[*] antikick"); MC.player.connection.send( new CPlayerPacket.PositionPacket(pos.x, pos.y - this.antikick_magnitude.get(), pos.z, false) ); @@ -105,7 +102,7 @@ public class VanillaFlight extends QuickModule implements ICommons { if (MC.player != null) { this.couldFlyBefore = MC.player.abilities.mayfly; this.flyingSpeedBefore = MC.player.abilities.getFlyingSpeed(); - BoSCoVicino.log(String.format("Flying speed before = %f", this.flyingSpeedBefore)); + Boscovicino.log(String.format("Flying speed before = %f", this.flyingSpeedBefore)); } } diff --git a/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java index eb64ac5..72fe395 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java +++ b/src/main/java/ftbsc/bscv/modules/self/AntiHunger.java @@ -1,16 +1,16 @@ package ftbsc.bscv.modules.self; +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Setting; import net.minecraft.network.play.client.CEntityActionPacket; -import net.minecraft.network.play.client.CPlayerPacket; import net.minecraft.network.play.client.CEntityActionPacket.Action; +import net.minecraft.network.play.client.CPlayerPacket; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class AntiHunger extends AbstractModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java b/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java index 636f946..4161f70 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoDisconnect.java @@ -1,19 +1,16 @@ package ftbsc.bscv.modules.self; -import com.mojang.brigadier.CommandDispatcher; - +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Setting; -import net.minecraft.command.CommandSource; import net.minecraft.network.play.server.SDisconnectPacket; import net.minecraft.network.play.server.SUpdateHealthPacket; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class AutoDisconnect extends AbstractModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoFish.java b/src/main/java/ftbsc/bscv/modules/self/AutoFish.java index eec5b16..b7a35fb 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoFish.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoFish.java @@ -1,6 +1,8 @@ package ftbsc.bscv.modules.self; +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Setting; @@ -10,8 +12,6 @@ import net.minecraft.util.Hand; import net.minecraft.util.SoundEvents; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class AutoFish extends AbstractModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java index 279002e..a036ecd 100644 --- a/src/main/java/ftbsc/bscv/modules/self/AutoTool.java +++ b/src/main/java/ftbsc/bscv/modules/self/AutoTool.java @@ -1,8 +1,8 @@ package ftbsc.bscv.modules.self; -import java.util.List; - +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.AbstractModule; import ftbsc.bscv.tools.Inventory; import ftbsc.bscv.tools.Setting; @@ -13,8 +13,8 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; + +import java.util.List; @AutoService(ILoadable.class) public class AutoTool extends AbstractModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java index ce3ebba..52bb33a 100644 --- a/src/main/java/ftbsc/bscv/modules/self/FastInteract.java +++ b/src/main/java/ftbsc/bscv/modules/self/FastInteract.java @@ -1,20 +1,15 @@ package ftbsc.bscv.modules.self; -import static ftbsc.bscv.BoSCoVicino.log; - -import java.lang.reflect.Field; - -import com.mojang.brigadier.CommandDispatcher; - -import net.minecraft.command.CommandSource; -import net.minecraftforge.common.ForgeConfigSpec; +import com.google.auto.service.AutoService; +import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; +import ftbsc.bscv.modules.QuickModule; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.modules.QuickModule; -import ftbsc.bscv.ICommons; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; +import java.lang.reflect.Field; + +import static ftbsc.bscv.Boscovicino.log; @AutoService(ILoadable.class) public class FastInteract extends QuickModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/self/Freecam.java b/src/main/java/ftbsc/bscv/modules/self/Freecam.java index 0bdbd1e..cd0c107 100644 --- a/src/main/java/ftbsc/bscv/modules/self/Freecam.java +++ b/src/main/java/ftbsc/bscv/modules/self/Freecam.java @@ -1,24 +1,21 @@ package ftbsc.bscv.modules.self; -import com.mojang.brigadier.CommandDispatcher; - -import ftbsc.bscv.BoSCoVicino; -import ftbsc.bscv.events.PacketEvent; +import com.google.auto.service.AutoService; +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; +import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.tools.Keyboard; import ftbsc.bscv.tools.Setting; import net.minecraft.client.entity.player.RemoteClientPlayerEntity; import net.minecraft.client.network.play.NetworkPlayerInfo; -import net.minecraft.command.CommandSource; import net.minecraft.network.play.client.CPlayerPacket; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.GameType; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class Freecam extends QuickModule implements ICommons { @@ -64,7 +61,7 @@ public class Freecam extends QuickModule implements ICommons { if (MC.player == null) return; if (event.outgoing && event.packet instanceof CPlayerPacket) { // TODO must ignore more packets than just this if (this.log.get()) { - BoSCoVicino.log(String.format("[X] %s", event.packet.getClass().getName())); + Boscovicino.log(String.format("[X] %s", event.packet.getClass().getName())); } event.setCanceled(true); } @@ -82,7 +79,7 @@ public class Freecam extends QuickModule implements ICommons { @Override protected void onEnabled() { if (MC.player == null) { - BoSCoVicino.log("[!] Can only enable freecam while in-game"); + Boscovicino.log("[!] Can only enable freecam while in-game"); this.disable(); } diff --git a/src/main/java/ftbsc/bscv/modules/self/PortalGui.java b/src/main/java/ftbsc/bscv/modules/self/PortalGui.java index 5c035a2..bffb111 100644 --- a/src/main/java/ftbsc/bscv/modules/self/PortalGui.java +++ b/src/main/java/ftbsc/bscv/modules/self/PortalGui.java @@ -1,11 +1,11 @@ package ftbsc.bscv.modules.self; +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.AbstractModule; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class PortalGui extends AbstractModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java b/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java index 754414d..f84a9e4 100644 --- a/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java +++ b/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java @@ -1,6 +1,8 @@ package ftbsc.bscv.modules.vision; +import com.google.auto.service.AutoService; import ftbsc.bscv.ICommons; +import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.QuickModule; import net.minecraft.potion.Effect; import net.minecraft.potion.EffectInstance; @@ -8,8 +10,6 @@ import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import java.awt.event.KeyEvent; -import ftbsc.bscv.api.ILoadable; -import com.google.auto.service.AutoService; @AutoService(ILoadable.class) public class Fullbright extends QuickModule implements ICommons { diff --git a/src/main/java/ftbsc/bscv/patches/BoatPatch.java b/src/main/java/ftbsc/bscv/patches/BoatPatch.java index f035a50..581243f 100644 --- a/src/main/java/ftbsc/bscv/patches/BoatPatch.java +++ b/src/main/java/ftbsc/bscv/patches/BoatPatch.java @@ -1,25 +1,16 @@ package ftbsc.bscv.patches; +import ftbsc.bscv.ICommons; +import ftbsc.bscv.events.BoatEvent; import ftbsc.lll.processor.annotations.Injector; import ftbsc.lll.processor.annotations.Patch; import ftbsc.lll.processor.annotations.Target; +import ftbsc.lll.tools.InsnSequence; import net.minecraft.entity.Entity; import net.minecraft.entity.item.BoatEntity; import net.minecraftforge.common.MinecraftForge; - import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.InsnNode; -import org.objectweb.asm.tree.JumpInsnNode; -import org.objectweb.asm.tree.LabelNode; -import org.objectweb.asm.tree.MethodInsnNode; -import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.VarInsnNode; - -import ftbsc.bscv.ICommons; -import ftbsc.bscv.events.BoatEvent; -import ftbsc.lll.IInjector; -import ftbsc.lll.tools.InsnSequence; +import org.objectweb.asm.tree.*; public class BoatPatch { diff --git a/src/main/java/ftbsc/bscv/patches/PacketPatch.java b/src/main/java/ftbsc/bscv/patches/PacketPatch.java index 610638e..daf2a7b 100644 --- a/src/main/java/ftbsc/bscv/patches/PacketPatch.java +++ b/src/main/java/ftbsc/bscv/patches/PacketPatch.java @@ -1,29 +1,18 @@ package ftbsc.bscv.patches; +import ftbsc.bscv.events.PacketEvent; import ftbsc.lll.processor.annotations.Injector; import ftbsc.lll.processor.annotations.Patch; import ftbsc.lll.processor.annotations.Target; +import ftbsc.lll.tools.InsnSequence; +import ftbsc.lll.tools.PatternMatcher; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.GenericFutureListener; import net.minecraft.network.IPacket; import net.minecraft.network.NetworkManager; import net.minecraftforge.common.MinecraftForge; - import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.InsnNode; -import org.objectweb.asm.tree.JumpInsnNode; -import org.objectweb.asm.tree.LabelNode; -import org.objectweb.asm.tree.MethodInsnNode; -import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.VarInsnNode; - -import ftbsc.bscv.events.PacketEvent; -import ftbsc.lll.IInjector; -import ftbsc.lll.tools.DescriptorBuilder; -import ftbsc.lll.tools.InsnSequence; -import ftbsc.lll.tools.PatternMatcher; +import org.objectweb.asm.tree.*; public class PacketPatch { diff --git a/src/main/java/ftbsc/bscv/tools/Inventory.java b/src/main/java/ftbsc/bscv/tools/Inventory.java index e63d0d1..5948773 100644 --- a/src/main/java/ftbsc/bscv/tools/Inventory.java +++ b/src/main/java/ftbsc/bscv/tools/Inventory.java @@ -1,8 +1,5 @@ package ftbsc.bscv.tools; -import java.util.Collection; -import java.util.List; - import ftbsc.bscv.ICommons; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.ai.attributes.AttributeModifier; @@ -11,6 +8,9 @@ import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; +import java.util.Collection; +import java.util.List; + public class Inventory implements ICommons { public static final int HOTBAR_SIZE = 9; diff --git a/src/main/java/ftbsc/bscv/tools/Setting.java b/src/main/java/ftbsc/bscv/tools/Setting.java index 19b719a..7f4d627 100644 --- a/src/main/java/ftbsc/bscv/tools/Setting.java +++ b/src/main/java/ftbsc/bscv/tools/Setting.java @@ -1,20 +1,15 @@ package ftbsc.bscv.tools; -import static ftbsc.bscv.BoSCoVicino.log; - -import java.util.Optional; - -import com.mojang.brigadier.arguments.ArgumentType; -import com.mojang.brigadier.arguments.BoolArgumentType; -import com.mojang.brigadier.arguments.DoubleArgumentType; -import com.mojang.brigadier.arguments.IntegerArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; - +import com.mojang.brigadier.arguments.*; import ftbsc.bscv.api.IModule; import net.minecraft.command.Commands; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.server.command.EnumArgument; +import java.util.Optional; + +import static ftbsc.bscv.Boscovicino.log; + public abstract class Setting { protected Optional name; diff --git a/src/main/java/ftbsc/bscv/tools/Text.java b/src/main/java/ftbsc/bscv/tools/Text.java index 36abaae..6346e29 100644 --- a/src/main/java/ftbsc/bscv/tools/Text.java +++ b/src/main/java/ftbsc/bscv/tools/Text.java @@ -2,7 +2,6 @@ package ftbsc.bscv.tools; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; - import ftbsc.bscv.ICommons; import net.minecraft.client.MainWindow; import net.minecraft.client.gui.FontRenderer; -- cgit v1.2.3-56-ga3b1