feat: implemented basic interface structure and made module constructors with no params
This commit is contained in:
parent
3be09e9384
commit
4359e3d285
25 changed files with 369 additions and 194 deletions
|
@ -1,5 +1,7 @@
|
||||||
package ftbsc.bscv;
|
package ftbsc.bscv;
|
||||||
|
|
||||||
|
import ftbsc.bscv.api.IModule;
|
||||||
|
import ftbsc.bscv.system.ModManager;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.client.gui.screen.IngameMenuScreen;
|
import net.minecraft.client.gui.screen.IngameMenuScreen;
|
||||||
import net.minecraft.client.gui.widget.button.Button;
|
import net.minecraft.client.gui.widget.button.Button;
|
||||||
|
@ -25,56 +27,49 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ftbsc.bscv.modules.Module;
|
|
||||||
import ftbsc.bscv.modules.vision.*;
|
import ftbsc.bscv.modules.vision.*;
|
||||||
import ftbsc.bscv.modules.motion.*;
|
import ftbsc.bscv.modules.motion.*;
|
||||||
import ftbsc.bscv.modules.self.*;
|
import ftbsc.bscv.modules.self.*;
|
||||||
import ftbsc.bscv.modules.hud.*;
|
import ftbsc.bscv.modules.hud.*;
|
||||||
import ftbsc.bscv.modules.defense.*;
|
import ftbsc.bscv.modules.defense.*;
|
||||||
|
|
||||||
// The value here should match an entry in the META-INF/mods.toml file
|
|
||||||
@Mod("bscv")
|
@Mod("bscv")
|
||||||
public class BoSCoVicino implements ICommons {
|
public class BoSCoVicino implements ICommons {
|
||||||
public static String MOD_ID = "bscv";
|
public static String MOD_ID = "bscv";
|
||||||
|
|
||||||
// Directly reference a log4j logger.
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger();
|
public static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
public static List<Module> mods;
|
public static ModManager modManager; //todo this should not be static
|
||||||
|
|
||||||
private final CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<>();
|
private final CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<>();
|
||||||
|
|
||||||
public static ForgeConfigSpec spec;
|
public static ForgeConfigSpec spec;
|
||||||
|
|
||||||
public BoSCoVicino() {
|
public BoSCoVicino() {
|
||||||
// Register the setup method for modloading
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
|
||||||
|
|
||||||
// load and register mods
|
|
||||||
BoSCoVicino.mods = new ArrayList<Module>();
|
|
||||||
|
|
||||||
ForgeConfigSpec.Builder cfg = new ForgeConfigSpec.Builder();
|
ForgeConfigSpec.Builder cfg = new ForgeConfigSpec.Builder();
|
||||||
CommandDispatcher<CommandSource> dp = this.dispatcher;
|
CommandDispatcher<CommandSource> dp = this.dispatcher;
|
||||||
|
|
||||||
BoSCoVicino.mods.add(new AutoDisconnect(cfg, dp).done(cfg));
|
this.modManager = new ModManager(cfg, dp);
|
||||||
BoSCoVicino.mods.add(new ActiveModules(cfg, dp).done(cfg));
|
|
||||||
BoSCoVicino.mods.add(new VanillaFlight(cfg, dp).done(cfg));
|
this.modManager.registerMod(new AutoDisconnect());
|
||||||
BoSCoVicino.mods.add(new FastInteract(cfg, dp).done(cfg));
|
this.modManager.registerMod(new ActiveModules());
|
||||||
BoSCoVicino.mods.add(new InfoDisplay(cfg, dp).done(cfg));
|
this.modManager.registerMod(new VanillaFlight());
|
||||||
BoSCoVicino.mods.add(new Coordinates(cfg, dp).done(cfg));
|
this.modManager.registerMod(new FastInteract());
|
||||||
BoSCoVicino.mods.add(new EntityList(cfg, dp).done(cfg));
|
this.modManager.registerMod(new InfoDisplay());
|
||||||
BoSCoVicino.mods.add(new PlayerList(cfg, dp).done(cfg));
|
this.modManager.registerMod(new Coordinates());
|
||||||
BoSCoVicino.mods.add(new Fullbright(cfg, dp).done(cfg));
|
this.modManager.registerMod(new EntityList());
|
||||||
BoSCoVicino.mods.add(new AntiHunger(cfg, dp).done(cfg));
|
this.modManager.registerMod(new PlayerList());
|
||||||
BoSCoVicino.mods.add(new PortalGui(cfg, dp).done(cfg));
|
this.modManager.registerMod(new Fullbright());
|
||||||
BoSCoVicino.mods.add(new AutoFish(cfg, dp).done(cfg));
|
this.modManager.registerMod(new AntiHunger());
|
||||||
BoSCoVicino.mods.add(new AutoTool(cfg, dp).done(cfg));
|
this.modManager.registerMod(new PortalGui());
|
||||||
BoSCoVicino.mods.add(new Freecam(cfg, dp).done(cfg));
|
this.modManager.registerMod(new AutoFish());
|
||||||
BoSCoVicino.mods.add(new BoatFly(cfg, dp).done(cfg));
|
this.modManager.registerMod(new AutoTool());
|
||||||
BoSCoVicino.mods.add(new Aura(cfg, dp).done(cfg));
|
this.modManager.registerMod(new Freecam());
|
||||||
|
this.modManager.registerMod(new BoatFly());
|
||||||
|
this.modManager.registerMod(new Aura());
|
||||||
|
|
||||||
BoSCoVicino.spec = cfg.build();
|
BoSCoVicino.spec = cfg.build();
|
||||||
|
|
||||||
|
@ -95,8 +90,8 @@ public class BoSCoVicino implements ICommons {
|
||||||
private void clientSetup(final FMLClientSetupEvent event) {
|
private void clientSetup(final FMLClientSetupEvent event) {
|
||||||
LOGGER.info("Initializing modules");
|
LOGGER.info("Initializing modules");
|
||||||
|
|
||||||
for (Module m : BoSCoVicino.mods) {
|
for (IModule<?> m : modManager.mods) {
|
||||||
if (m.enabled.get()) m.enable();
|
if (m.isEnabled()) m.enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEMPORARY! add command to regenerate suggestions
|
// TEMPORARY! add command to regenerate suggestions
|
||||||
|
@ -132,8 +127,8 @@ public class BoSCoVicino implements ICommons {
|
||||||
dispatcher.register(
|
dispatcher.register(
|
||||||
Commands.literal("toggle-all")
|
Commands.literal("toggle-all")
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
for (Module mod : BoSCoVicino.mods) {
|
for (IModule<?> mod : modManager.mods) {
|
||||||
if (mod.enabled.get()) {
|
if (mod.isEnabled()) {
|
||||||
mod.disable();
|
mod.disable();
|
||||||
mod.enable();
|
mod.enable();
|
||||||
}
|
}
|
||||||
|
|
8
src/main/java/ftbsc/bscv/api/ICommand.java
Normal file
8
src/main/java/ftbsc/bscv/api/ICommand.java
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package ftbsc.bscv.api;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
|
||||||
|
public interface ICommand extends ILoadable {
|
||||||
|
CommandDispatcher<CommandSource> getDispatcher();
|
||||||
|
}
|
5
src/main/java/ftbsc/bscv/api/ILoadable.java
Normal file
5
src/main/java/ftbsc/bscv/api/ILoadable.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package ftbsc.bscv.api;
|
||||||
|
|
||||||
|
public interface ILoadable {
|
||||||
|
String getName();
|
||||||
|
}
|
17
src/main/java/ftbsc/bscv/api/IModule.java
Normal file
17
src/main/java/ftbsc/bscv/api/IModule.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package ftbsc.bscv.api;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
|
public interface IModule<T extends Enum<T>> extends ICommand {
|
||||||
|
T getGroup();
|
||||||
|
|
||||||
|
ForgeConfigSpec.Builder getConfigBuilder();
|
||||||
|
|
||||||
|
void toggle();
|
||||||
|
|
||||||
|
void enable();
|
||||||
|
|
||||||
|
void disable();
|
||||||
|
|
||||||
|
boolean isEnabled();
|
||||||
|
}
|
|
@ -3,6 +3,9 @@ package ftbsc.bscv.modules;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
|
|
||||||
|
import ftbsc.bscv.BoSCoVicino;
|
||||||
|
import ftbsc.bscv.api.IModule;
|
||||||
|
import ftbsc.bscv.system.ModManager;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
@ -10,7 +13,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import static ftbsc.bscv.BoSCoVicino.log;
|
import static ftbsc.bscv.BoSCoVicino.log;
|
||||||
|
|
||||||
public abstract class AbstractModule {
|
public abstract class AbstractModule implements IModule<AbstractModule.Group> {
|
||||||
public enum Group {
|
public enum Group {
|
||||||
SELF,
|
SELF,
|
||||||
HUD,
|
HUD,
|
||||||
|
@ -20,20 +23,27 @@ public abstract class AbstractModule {
|
||||||
MOTION,
|
MOTION,
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String name;
|
|
||||||
public final Group group;
|
|
||||||
|
|
||||||
protected ForgeConfigSpec.ConfigValue<Boolean> enabled;
|
protected ForgeConfigSpec.ConfigValue<Boolean> enabled;
|
||||||
|
|
||||||
public void initialize(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
builder.push(this.name.toLowerCase());
|
public ForgeConfigSpec.Builder getConfigBuilder() {
|
||||||
this.enabled = builder
|
return BoSCoVicino.modManager.getCfgBuilder();
|
||||||
.comment(String.format("Enables %s", this.name))
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandDispatcher<CommandSource> getDispatcher() {
|
||||||
|
return BoSCoVicino.modManager.getDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractModule() {
|
||||||
|
this.getConfigBuilder().push(this.getName().toLowerCase());
|
||||||
|
this.enabled = this.getConfigBuilder()
|
||||||
|
.comment(String.format("Enables %s", this.getName()))
|
||||||
.define("enabled", false);
|
.define("enabled", false);
|
||||||
|
|
||||||
// TODO: can this be made an util or moved somewhere else?
|
// TODO: can this be made an util or moved somewhere else?
|
||||||
dispatcher.register(
|
this.getDispatcher().register(
|
||||||
Commands.literal(this.name.toLowerCase())
|
Commands.literal(this.getName().toLowerCase())
|
||||||
.then(
|
.then(
|
||||||
Commands.literal("toggle")
|
Commands.literal("toggle")
|
||||||
.then(
|
.then(
|
||||||
|
@ -53,31 +63,13 @@ public abstract class AbstractModule {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.executes(ctx -> {
|
.executes(ctx -> {
|
||||||
log(String.format("%s [%s]", this.name, this.enabled.get() ? "ON" : "OFF"));
|
log(String.format("%s [%s]", this.getName(), this.enabled.get() ? "ON" : "OFF"));
|
||||||
// TODO: print all mod options!
|
// TODO: print all mod options!
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.register(builder, dispatcher);
|
this.getConfigBuilder().pop();
|
||||||
|
|
||||||
builder.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void register(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher);
|
|
||||||
|
|
||||||
protected AbstractModule(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
|
||||||
// TODO can this be done in a less magic way?
|
|
||||||
String[] pkg = this.getClass().getPackage().getName().split(".");
|
|
||||||
this.group = Group.valueOf(pkg[pkg.length-1].toUpperCase());
|
|
||||||
this.name = this.getClass().getName();
|
|
||||||
|
|
||||||
this.initialize(builder, dispatcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractModule done(ForgeConfigSpec.Builder builder) {
|
|
||||||
builder.pop();
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onEnabled() {}
|
protected void onEnabled() {}
|
||||||
|
@ -93,7 +85,7 @@ public abstract class AbstractModule {
|
||||||
this.enabled.set(true);
|
this.enabled.set(true);
|
||||||
// this.enabled.save();
|
// this.enabled.save();
|
||||||
this.onEnabled();
|
this.onEnabled();
|
||||||
log(String.format("%s ON", this.name));
|
log(String.format("%s ON", this.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void disable() {
|
public final void disable() {
|
||||||
|
@ -101,6 +93,11 @@ public abstract class AbstractModule {
|
||||||
this.enabled.set(false);
|
this.enabled.set(false);
|
||||||
// this.enabled.save();
|
// this.enabled.save();
|
||||||
this.onDisabled();
|
this.onDisabled();
|
||||||
log(String.format("%s OFF", this.name));
|
log(String.format("%s OFF", this.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,46 +8,46 @@ import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
public abstract class HudModule extends Module {
|
public abstract class HudModule extends AbstractModule {
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Integer> x;
|
public final ForgeConfigSpec.ConfigValue<Integer> x;
|
||||||
public final ForgeConfigSpec.ConfigValue<Integer> y;
|
public final ForgeConfigSpec.ConfigValue<Integer> y;
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> scale;
|
public final ForgeConfigSpec.ConfigValue<Double> scale;
|
||||||
public final ForgeConfigSpec.ConfigValue<Anchor> anchor;
|
public final ForgeConfigSpec.ConfigValue<Anchor> anchor;
|
||||||
|
|
||||||
protected HudModule(String name, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super(name, Group.HUD, builder, dispatcher);
|
public Group getGroup() {
|
||||||
|
return Group.HUD;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HudModule() {
|
||||||
|
super();
|
||||||
this.x = Setting.Number.builder()
|
this.x = Setting.Number.builder()
|
||||||
.name("x")
|
.name("x")
|
||||||
.comment("horizontal offset")
|
.comment("horizontal offset")
|
||||||
.fallback(0)
|
.fallback(0)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.y = Setting.Number.builder()
|
this.y = Setting.Number.builder()
|
||||||
.name("y")
|
.name("y")
|
||||||
.comment("vertical offset")
|
.comment("vertical offset")
|
||||||
.fallback(0)
|
.fallback(0)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.scale = Setting.Decimal.builder()
|
this.scale = Setting.Decimal.builder()
|
||||||
.name("scale")
|
.name("scale")
|
||||||
.comment("scale of element")
|
.comment("scale of element")
|
||||||
.fallback(1.0)
|
.fallback(1.0)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.anchor = Setting.Switch.builder(Anchor.class)
|
this.anchor = Setting.Switch.builder(Anchor.class)
|
||||||
.name("anchor")
|
.name("anchor")
|
||||||
.comment("origin point for coordinates")
|
.comment("origin point for coordinates")
|
||||||
.fallback(Anchor.TOPLEFT)
|
.fallback(Anchor.TOPLEFT)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldHide() {
|
protected boolean shouldHide() {
|
||||||
if (ICommons.MC.options.renderDebug) {
|
return ICommons.MC.options.renderDebug;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,17 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import ftbsc.bscv.BoSCoVicino;
|
import ftbsc.bscv.BoSCoVicino;
|
||||||
|
|
||||||
// TODO rename
|
// TODO rename
|
||||||
public class QuickModule extends Module {
|
public abstract class QuickModule extends AbstractModule {
|
||||||
|
|
||||||
public static final int UNBOUND = InputMappings.UNKNOWN.getValue();
|
public static final int UNBOUND = InputMappings.UNKNOWN.getValue();
|
||||||
|
|
||||||
private class ToggleHook {
|
private class ToggleHook {
|
||||||
private final KeyBinding key;
|
private final KeyBinding key;
|
||||||
private final Module mod;
|
private final QuickModule mod;
|
||||||
private boolean debounce;
|
private boolean debounce;
|
||||||
// TODO all examples show isPressed() to get a debounced value
|
// TODO all examples show isPressed() to get a debounced value
|
||||||
// but it seems to be missing? making my own debounce for now
|
// but it seems to be missing? making my own debounce for now
|
||||||
protected ToggleHook(KeyBinding key, Module mod) {
|
protected ToggleHook(KeyBinding key, QuickModule mod) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
this.debounce = false;
|
this.debounce = false;
|
||||||
|
@ -51,10 +51,12 @@ public class QuickModule extends Module {
|
||||||
|
|
||||||
public final KeyBinding keybind;
|
public final KeyBinding keybind;
|
||||||
|
|
||||||
public QuickModule(String name, Group group, int default_key, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
protected abstract int getDefaultKey();
|
||||||
super(name, group, builder, dispatcher);
|
|
||||||
|
|
||||||
this.keybind = new KeyBinding(key_name(name), default_key, key_category());
|
public QuickModule() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.keybind = new KeyBinding(key_name(this.getName()), this.getDefaultKey(), key_category());
|
||||||
ClientRegistry.registerKeyBinding(this.keybind);
|
ClientRegistry.registerKeyBinding(this.keybind);
|
||||||
|
|
||||||
// register a separate subclass on the hook, so that it's always listening
|
// register a separate subclass on the hook, so that it's always listening
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ftbsc.bscv.modules.defense;
|
package ftbsc.bscv.modules.defense;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.arguments.DoubleArgumentType;
|
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.modules.QuickModule;
|
import ftbsc.bscv.modules.QuickModule;
|
||||||
|
@ -16,18 +15,33 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class Aura extends QuickModule implements ICommons {
|
public class Aura extends QuickModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Aura";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.DEFENSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDefaultKey() {
|
||||||
|
return UNBOUND;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> reach;
|
public final ForgeConfigSpec.ConfigValue<Double> reach;
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> strenght;
|
public final ForgeConfigSpec.ConfigValue<Double> strenght;
|
||||||
|
|
||||||
public Aura(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public Aura() {
|
||||||
super("Aura", Group.DEFENSE, UNBOUND, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.reach = Setting.Decimal.builder()
|
this.reach = Setting.Decimal.builder()
|
||||||
.min(0.)
|
.min(0.)
|
||||||
.fallback(5.)
|
.fallback(5.)
|
||||||
.name("reach")
|
.name("reach")
|
||||||
.comment("aura attack reach")
|
.comment("aura attack reach")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.strenght = Setting.Decimal.builder()
|
this.strenght = Setting.Decimal.builder()
|
||||||
.min(0.)
|
.min(0.)
|
||||||
|
@ -35,7 +49,7 @@ public class Aura extends QuickModule implements ICommons {
|
||||||
.name("strenght")
|
.name("strenght")
|
||||||
.comment("minimum strenght required for attack")
|
.comment("minimum strenght required for attack")
|
||||||
.fallback(1.)
|
.fallback(1.)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
package ftbsc.bscv.modules.hud;
|
package ftbsc.bscv.modules.hud;
|
||||||
|
|
||||||
import static ftbsc.bscv.tools.Text.TextBuilder;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
|
|
||||||
import ftbsc.bscv.BoSCoVicino;
|
import ftbsc.bscv.BoSCoVicino;
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import net.minecraft.command.CommandSource;
|
import ftbsc.bscv.api.IModule;
|
||||||
|
import ftbsc.bscv.modules.HudModule;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import ftbsc.bscv.modules.HudModule;
|
|
||||||
import ftbsc.bscv.modules.Module;
|
import static ftbsc.bscv.tools.Text.TextBuilder;
|
||||||
|
|
||||||
public class ActiveModules extends HudModule implements ICommons {
|
public class ActiveModules extends HudModule implements ICommons {
|
||||||
|
|
||||||
public ActiveModules(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super("ActiveModules", builder, dispatcher);
|
public String getName() {
|
||||||
|
return "ActiveModules";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderOverlay(RenderGameOverlayEvent event) {
|
public void onRenderOverlay(RenderGameOverlayEvent event) {
|
||||||
if (event.getType() == ElementType.TEXT) {
|
if (event.getType() == ElementType.TEXT) {
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (Module m : BoSCoVicino.mods) {
|
for (IModule<?> m : BoSCoVicino.modManager.mods) {
|
||||||
if (m.enabled.get() && m.group != Group.HUD) {
|
if (m.isEnabled() && m.getGroup() != Group.HUD) {
|
||||||
TextBuilder()
|
TextBuilder()
|
||||||
.txt(String.format("%s <", m.name))
|
.txt(String.format("%s <", m.getName()))
|
||||||
.anchor(this.anchor.get())
|
.anchor(this.anchor.get())
|
||||||
.x(this.x.get())
|
.x(this.x.get())
|
||||||
.y(this.y.get() + offset)
|
.y(this.y.get() + offset)
|
||||||
|
|
|
@ -15,8 +15,9 @@ import ftbsc.bscv.modules.HudModule;
|
||||||
|
|
||||||
public class Coordinates extends HudModule implements ICommons {
|
public class Coordinates extends HudModule implements ICommons {
|
||||||
|
|
||||||
public Coordinates(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super("Coordinates", builder, dispatcher);
|
public String getName() {
|
||||||
|
return "Coordinates";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -24,16 +24,21 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class EntityList extends HudModule implements ICommons {
|
public class EntityList extends HudModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EntityList";
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<String> search;
|
public final ForgeConfigSpec.ConfigValue<String> search;
|
||||||
|
|
||||||
public EntityList(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public EntityList() {
|
||||||
super("EntityList", builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.search = Setting.Str.builder()
|
this.search = Setting.Str.builder()
|
||||||
.name("search")
|
.name("search")
|
||||||
.comment("highlight names containing this text")
|
.comment("highlight names containing this text")
|
||||||
.fallback("")
|
.fallback("")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -23,6 +23,10 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class InfoDisplay extends HudModule implements ICommons {
|
public class InfoDisplay extends HudModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "InfoDisplay";
|
||||||
|
}
|
||||||
|
|
||||||
private Vector3d last_position = new Vector3d(0.0, 0.0, 0.0);
|
private Vector3d last_position = new Vector3d(0.0, 0.0, 0.0);
|
||||||
private double instant_speed = 0.0;
|
private double instant_speed = 0.0;
|
||||||
|
@ -45,32 +49,32 @@ public class InfoDisplay extends HudModule implements ICommons {
|
||||||
// public final ForgeConfigSpec.ConfigValue<Boolean> client_chunk_size;
|
// public final ForgeConfigSpec.ConfigValue<Boolean> client_chunk_size;
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> hide_effects;
|
public final ForgeConfigSpec.ConfigValue<Boolean> hide_effects;
|
||||||
|
|
||||||
public InfoDisplay(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public InfoDisplay() {
|
||||||
super("InfoDisplay", builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.logo = Setting.Bool.builder()
|
this.logo = Setting.Bool.builder()
|
||||||
.name("logo")
|
.name("logo")
|
||||||
.comment("show logo at top of list")
|
.comment("show logo at top of list")
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.speed = Setting.Bool.builder()
|
this.speed = Setting.Bool.builder()
|
||||||
.name("speed")
|
.name("speed")
|
||||||
.comment("show speed meter")
|
.comment("show speed meter")
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.time = Setting.Bool.builder()
|
this.time = Setting.Bool.builder()
|
||||||
.name("time")
|
.name("time")
|
||||||
.comment("show world time")
|
.comment("show world time")
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.hide_effects = Setting.Bool.builder()
|
this.hide_effects = Setting.Bool.builder()
|
||||||
.name("hide-effects")
|
.name("hide-effects")
|
||||||
.comment("hide effect icons on top right corner")
|
.comment("hide effect icons on top right corner")
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -15,9 +15,9 @@ import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class PlayerList extends HudModule implements ICommons {
|
public class PlayerList extends HudModule implements ICommons {
|
||||||
|
@Override
|
||||||
public PlayerList(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public String getName() {
|
||||||
super("PlayerList", builder, dispatcher);
|
return "PlayerList";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package ftbsc.bscv.modules.motion;
|
package ftbsc.bscv.modules.motion;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
|
||||||
import com.mojang.brigadier.arguments.DoubleArgumentType;
|
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.events.BoatEvent;
|
import ftbsc.bscv.events.BoatEvent;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import ftbsc.bscv.tools.Keyboard;
|
import ftbsc.bscv.tools.Keyboard;
|
||||||
import ftbsc.bscv.tools.Setting;
|
import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
|
@ -17,7 +14,17 @@ import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.event.TickEvent.Phase;
|
import net.minecraftforge.event.TickEvent.Phase;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class BoatFly extends Module implements ICommons {
|
public class BoatFly extends AbstractModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "BoatFly";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.MOTION;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> speed;
|
public final ForgeConfigSpec.ConfigValue<Double> speed;
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> rise;
|
public final ForgeConfigSpec.ConfigValue<Double> rise;
|
||||||
|
@ -26,45 +33,45 @@ public class BoatFly extends Module implements ICommons {
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
|
public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> drift;
|
public final ForgeConfigSpec.ConfigValue<Boolean> drift;
|
||||||
|
|
||||||
public BoatFly(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public BoatFly() {
|
||||||
super("BoatFly", Group.MOTION, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.speed = Setting.Decimal.builder()
|
this.speed = Setting.Decimal.builder()
|
||||||
.fallback(1.)
|
.fallback(1.)
|
||||||
.name("speed")
|
.name("speed")
|
||||||
.comment("magnitude of boat movement")
|
.comment("magnitude of boat movement")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.rise = Setting.Decimal.builder()
|
this.rise = Setting.Decimal.builder()
|
||||||
.min(0.)
|
.min(0.)
|
||||||
.fallback(0.5)
|
.fallback(0.5)
|
||||||
.name("rise")
|
.name("rise")
|
||||||
.comment("vertical speed")
|
.comment("vertical speed")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.gravity = Setting.Bool.builder()
|
this.gravity = Setting.Bool.builder()
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.name("gravity")
|
.name("gravity")
|
||||||
.comment("toggle boat gravity")
|
.comment("toggle boat gravity")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.rotation = Setting.Bool.builder()
|
this.rotation = Setting.Bool.builder()
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.name("rotation")
|
.name("rotation")
|
||||||
.comment("rotate boat with player")
|
.comment("rotate boat with player")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.sprint = Setting.Bool.builder()
|
this.sprint = Setting.Bool.builder()
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.name("sprint")
|
.name("sprint")
|
||||||
.comment("halve boat speed while not sprinting")
|
.comment("halve boat speed while not sprinting")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.drift = Setting.Bool.builder()
|
this.drift = Setting.Bool.builder()
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.name("drift")
|
.name("drift")
|
||||||
.comment("allow boat drifting")
|
.comment("allow boat drifting")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -16,6 +16,20 @@ import net.minecraftforge.event.TickEvent.Phase;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class VanillaFlight extends QuickModule implements ICommons {
|
public class VanillaFlight extends QuickModule implements ICommons {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "VanillaFlight";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.MOTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDefaultKey() {
|
||||||
|
return UNBOUND;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> force;
|
public final ForgeConfigSpec.ConfigValue<Boolean> force;
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> speed;
|
public final ForgeConfigSpec.ConfigValue<Double> speed;
|
||||||
|
@ -25,34 +39,34 @@ public class VanillaFlight extends QuickModule implements ICommons {
|
||||||
|
|
||||||
private int tick = 0;
|
private int tick = 0;
|
||||||
|
|
||||||
public VanillaFlight(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public VanillaFlight() {
|
||||||
super("VanillaFlight", Group.MOTION, UNBOUND, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.force = Setting.Bool.builder()
|
this.force = Setting.Bool.builder()
|
||||||
.name("force")
|
.name("force")
|
||||||
.comment("force enable flight on user")
|
.comment("force enable flight on user")
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.speed = Setting.Decimal.builder()
|
this.speed = Setting.Decimal.builder()
|
||||||
.min(0.)
|
.min(0.)
|
||||||
.fallback(0.05)
|
.fallback(0.05)
|
||||||
.name("speed")
|
.name("speed")
|
||||||
.comment("flight speed to set")
|
.comment("flight speed to set")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.antikick = Setting.Bool.builder()
|
this.antikick = Setting.Bool.builder()
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.name("antikick")
|
.name("antikick")
|
||||||
.comment("prevent vanilla flight kick by descending")
|
.comment("prevent vanilla flight kick by descending")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.antikick_magnitude = Setting.Decimal.builder()
|
this.antikick_magnitude = Setting.Decimal.builder()
|
||||||
.min(0.)
|
.min(0.)
|
||||||
.fallback(1.)
|
.fallback(1.)
|
||||||
.name("magnitude")
|
.name("magnitude")
|
||||||
.comment("magnitude of antikick push")
|
.comment("magnitude of antikick push")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.antikick_cycle = Setting.Number.builder()
|
this.antikick_cycle = Setting.Number.builder()
|
||||||
.min(0)
|
.min(0)
|
||||||
|
@ -60,7 +74,7 @@ public class VanillaFlight extends QuickModule implements ICommons {
|
||||||
.fallback(0)
|
.fallback(0)
|
||||||
.name("cycle")
|
.name("cycle")
|
||||||
.comment("how often to run antikick routine")
|
.comment("how often to run antikick routine")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean couldFlyBefore = false;
|
private boolean couldFlyBefore = false;
|
||||||
|
|
|
@ -1,37 +1,43 @@
|
||||||
package ftbsc.bscv.modules.self;
|
package ftbsc.bscv.modules.self;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.events.PacketEvent;
|
import ftbsc.bscv.events.PacketEvent;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import ftbsc.bscv.tools.Setting;
|
import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.command.CommandSource;
|
|
||||||
import net.minecraft.network.play.client.CEntityActionPacket;
|
import net.minecraft.network.play.client.CEntityActionPacket;
|
||||||
import net.minecraft.network.play.client.CPlayerPacket;
|
import net.minecraft.network.play.client.CPlayerPacket;
|
||||||
import net.minecraft.network.play.client.CEntityActionPacket.Action;
|
import net.minecraft.network.play.client.CEntityActionPacket.Action;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class AntiHunger extends Module implements ICommons {
|
public class AntiHunger extends AbstractModule implements ICommons {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AntiHunger";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
|
public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> hover;
|
public final ForgeConfigSpec.ConfigValue<Boolean> hover;
|
||||||
|
|
||||||
public AntiHunger(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public AntiHunger() {
|
||||||
super("AntiHunger", Group.SELF, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.sprint = Setting.Bool.builder()
|
this.sprint = Setting.Bool.builder()
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.name("sprint")
|
.name("sprint")
|
||||||
.comment("mask sprint toggle packets")
|
.comment("mask sprint toggle packets")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.hover = Setting.Bool.builder()
|
this.hover = Setting.Bool.builder()
|
||||||
.name("hover")
|
.name("hover")
|
||||||
.comment("mark as not on-ground while walking")
|
.comment("mark as not on-ground while walking")
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.events.PacketEvent;
|
import ftbsc.bscv.events.PacketEvent;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import ftbsc.bscv.tools.Setting;
|
import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.network.play.server.SDisconnectPacket;
|
import net.minecraft.network.play.server.SDisconnectPacket;
|
||||||
|
@ -13,18 +13,28 @@ import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class AutoDisconnect extends Module implements ICommons {
|
public class AutoDisconnect extends AbstractModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AutoDisconnect";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Double> threshold;
|
public final ForgeConfigSpec.ConfigValue<Double> threshold;
|
||||||
|
|
||||||
public AutoDisconnect(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public AutoDisconnect() {
|
||||||
super("AutoDisconnect", Group.SELF, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.threshold = Setting.Decimal.builder()
|
this.threshold = Setting.Decimal.builder()
|
||||||
.fallback(10.)
|
.fallback(10.)
|
||||||
.name("threshold")
|
.name("threshold")
|
||||||
.comment("hp below which connection should be closed")
|
.comment("hp below which connection should be closed")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.events.PacketEvent;
|
import ftbsc.bscv.events.PacketEvent;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import ftbsc.bscv.tools.Setting;
|
import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
|
@ -14,26 +14,36 @@ import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class AutoFish extends Module implements ICommons {
|
public class AutoFish extends AbstractModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AutoFish";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Boolean> recast;
|
public final ForgeConfigSpec.ConfigValue<Boolean> recast;
|
||||||
public final ForgeConfigSpec.ConfigValue<Integer> delay;
|
public final ForgeConfigSpec.ConfigValue<Integer> delay;
|
||||||
// public final ForgeConfigSpec.ConfigValue<Long> reaction;
|
// public final ForgeConfigSpec.ConfigValue<Long> reaction;
|
||||||
|
|
||||||
public AutoFish(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public AutoFish() {
|
||||||
super("AutoFish", Group.SELF, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.recast = Setting.Bool.builder()
|
this.recast = Setting.Bool.builder()
|
||||||
.name("recast")
|
.name("recast")
|
||||||
.comment("automatically recast hook after fishing")
|
.comment("automatically recast hook after fishing")
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.delay = Setting.Number.builder()
|
this.delay = Setting.Number.builder()
|
||||||
.fallback(2500)
|
.fallback(2500)
|
||||||
.name("delay")
|
.name("delay")
|
||||||
.comment("how long in ms to wait before recasting hook")
|
.comment("how long in ms to wait before recasting hook")
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -2,14 +2,11 @@ package ftbsc.bscv.modules.self;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import ftbsc.bscv.tools.Inventory;
|
import ftbsc.bscv.tools.Inventory;
|
||||||
import ftbsc.bscv.tools.Setting;
|
import ftbsc.bscv.tools.Setting;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.command.CommandSource;
|
|
||||||
import net.minecraft.inventory.container.Slot;
|
import net.minecraft.inventory.container.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
|
@ -17,18 +14,28 @@ import net.minecraftforge.client.event.InputEvent;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class AutoTool extends Module implements ICommons {
|
public class AutoTool extends AbstractModule implements ICommons {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AutoTool";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractModule.Group getGroup() {
|
||||||
|
return AbstractModule.Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
public final ForgeConfigSpec.ConfigValue<Integer> limit;
|
public final ForgeConfigSpec.ConfigValue<Integer> limit;
|
||||||
|
|
||||||
public AutoTool(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public AutoTool() {
|
||||||
super("AutoTool", Group.SELF, builder, dispatcher);
|
super();
|
||||||
|
|
||||||
this.limit = Setting.Number.builder()
|
this.limit = Setting.Number.builder()
|
||||||
.name("limit")
|
.name("limit")
|
||||||
.comment("durability limit for tools, set to 0 to destroy them")
|
.comment("durability limit for tools, set to 0 to destroy them")
|
||||||
.fallback(1)
|
.fallback(1)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean itemIsTooDamaged(ItemStack item) {
|
private boolean itemIsTooDamaged(ItemStack item) {
|
||||||
|
|
|
@ -15,13 +15,23 @@ import ftbsc.bscv.modules.QuickModule;
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
|
|
||||||
public class FastInteract extends QuickModule implements ICommons {
|
public class FastInteract extends QuickModule implements ICommons {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "FastInteract";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDefaultKey() {
|
||||||
|
return UNBOUND;
|
||||||
|
}
|
||||||
|
|
||||||
Field delayField;
|
Field delayField;
|
||||||
|
|
||||||
public FastInteract(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
|
||||||
super("FastInteract", Group.SELF, UNBOUND, builder, dispatcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnabled() {
|
protected void onEnabled() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -29,26 +29,41 @@ public class Freecam extends QuickModule implements ICommons {
|
||||||
private GameType prev_gamemode = GameType.SURVIVAL;
|
private GameType prev_gamemode = GameType.SURVIVAL;
|
||||||
private MockPlayer mock_player;
|
private MockPlayer mock_player;
|
||||||
|
|
||||||
public Freecam(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super("Freecam", Group.SELF, UNBOUND, builder, dispatcher);
|
public String getName() {
|
||||||
|
return "Freecam";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDefaultKey() {
|
||||||
|
return UNBOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Freecam() {
|
||||||
|
super();
|
||||||
|
|
||||||
this.log = Setting.Bool.builder()
|
this.log = Setting.Bool.builder()
|
||||||
.name("log")
|
.name("log")
|
||||||
.comment("log canceled packets")
|
.comment("log canceled packets")
|
||||||
.fallback(false)
|
.fallback(false)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.speed = Setting.Decimal.builder()
|
this.speed = Setting.Decimal.builder()
|
||||||
.name("speed")
|
.name("speed")
|
||||||
.comment("flight speed in freecam")
|
.comment("flight speed in freecam")
|
||||||
.fallback(0.05)
|
.fallback(0.05)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
|
|
||||||
this.drift = Setting.Bool.builder()
|
this.drift = Setting.Bool.builder()
|
||||||
.name("drift")
|
.name("drift")
|
||||||
.comment("allow inertia drift in freecam")
|
.comment("allow inertia drift in freecam")
|
||||||
.fallback(true)
|
.fallback(true)
|
||||||
.build(this.name, builder, dispatcher);
|
.build(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
package ftbsc.bscv.modules.self;
|
package ftbsc.bscv.modules.self;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
|
|
||||||
import ftbsc.bscv.ICommons;
|
import ftbsc.bscv.ICommons;
|
||||||
import ftbsc.bscv.modules.Module;
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
import net.minecraft.command.CommandSource;
|
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class PortalGui extends Module implements ICommons {
|
public class PortalGui extends AbstractModule implements ICommons {
|
||||||
|
|
||||||
public PortalGui(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super("PortalGui", Group.SELF, builder, dispatcher);
|
public String getName() {
|
||||||
|
return "PortalGui";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.SELF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -1,23 +1,29 @@
|
||||||
package ftbsc.bscv.modules.vision;
|
package ftbsc.bscv.modules.vision;
|
||||||
|
|
||||||
import java.awt.event.KeyEvent;
|
import ftbsc.bscv.ICommons;
|
||||||
|
import ftbsc.bscv.modules.QuickModule;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandSource;
|
|
||||||
import net.minecraft.potion.Effect;
|
import net.minecraft.potion.Effect;
|
||||||
import net.minecraft.potion.EffectInstance;
|
import net.minecraft.potion.EffectInstance;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
import ftbsc.bscv.modules.QuickModule;
|
import java.awt.event.KeyEvent;
|
||||||
import ftbsc.bscv.ICommons;
|
|
||||||
|
|
||||||
public class Fullbright extends QuickModule implements ICommons {
|
public class Fullbright extends QuickModule implements ICommons {
|
||||||
|
|
||||||
public Fullbright(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
@Override
|
||||||
super("Fullbright", Group.VISION, KeyEvent.VK_V, builder, dispatcher);
|
public String getName() {
|
||||||
|
return "Fullbright";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Group getGroup() {
|
||||||
|
return Group.VISION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDefaultKey() {
|
||||||
|
return KeyEvent.VK_V;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
42
src/main/java/ftbsc/bscv/system/ModManager.java
Normal file
42
src/main/java/ftbsc/bscv/system/ModManager.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package ftbsc.bscv.system;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import ftbsc.bscv.BoSCoVicino;
|
||||||
|
import ftbsc.bscv.api.IModule;
|
||||||
|
import ftbsc.bscv.modules.AbstractModule;
|
||||||
|
import ftbsc.bscv.modules.defense.Aura;
|
||||||
|
import ftbsc.bscv.modules.hud.*;
|
||||||
|
import ftbsc.bscv.modules.motion.BoatFly;
|
||||||
|
import ftbsc.bscv.modules.motion.VanillaFlight;
|
||||||
|
import ftbsc.bscv.modules.self.*;
|
||||||
|
import ftbsc.bscv.modules.vision.Fullbright;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ModManager {
|
||||||
|
private final ForgeConfigSpec.Builder cfgBuilder;
|
||||||
|
private final CommandDispatcher<CommandSource> dispatcher;
|
||||||
|
|
||||||
|
public final Set<IModule<? extends Enum<?>> > mods;
|
||||||
|
|
||||||
|
public ModManager(ForgeConfigSpec.Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
|
||||||
|
this.cfgBuilder = cfgBuilder;
|
||||||
|
this.dispatcher = dispatcher;
|
||||||
|
this.mods = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerMod(IModule<? extends Enum<?>> mod) {
|
||||||
|
this.mods.add(mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForgeConfigSpec.Builder getCfgBuilder() {
|
||||||
|
return cfgBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandDispatcher<CommandSource> getDispatcher() {
|
||||||
|
return dispatcher;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ import com.mojang.brigadier.arguments.DoubleArgumentType;
|
||||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
|
||||||
|
import ftbsc.bscv.api.IModule;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
|
@ -50,11 +51,11 @@ public abstract class Setting<T> {
|
||||||
|
|
||||||
abstract Class<T> clazz();
|
abstract Class<T> clazz();
|
||||||
|
|
||||||
public ForgeConfigSpec.ConfigValue<T> build(String scope, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
|
public ForgeConfigSpec.ConfigValue<T> build(IModule<?> module) {
|
||||||
ForgeConfigSpec.ConfigValue<T> conf = this.value(builder);
|
ForgeConfigSpec.ConfigValue<T> conf = this.value(module.getConfigBuilder());
|
||||||
|
|
||||||
dispatcher.register(
|
module.getDispatcher().register(
|
||||||
Commands.literal(scope.toLowerCase())
|
Commands.literal(module.getName().toLowerCase())
|
||||||
.then(
|
.then(
|
||||||
Commands.literal(this.name.get())
|
Commands.literal(this.name.get())
|
||||||
.then(
|
.then(
|
||||||
|
|
Loading…
Reference in a new issue