chore: converted old settings

This commit is contained in:
əlemi 2023-02-27 03:46:08 +01:00
parent 01ad24cc88
commit 38d183a775
Signed by: alemi
GPG key ID: A4895B84D311642C
13 changed files with 200 additions and 262 deletions

View file

@ -1,47 +1,53 @@
package ftbsc.bscv.modules; package ftbsc.bscv.modules;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.DoubleArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import ftbsc.bscv.ICommons;
import ftbsc.bscv.tools.Anchor; import ftbsc.bscv.tools.Anchor;
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;
import net.minecraftforge.server.command.EnumArgument;
public abstract class HudModule extends Module { public abstract class HudModule extends Module {
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.EnumValue<Anchor> anchor; public final ForgeConfigSpec.ConfigValue<Anchor> anchor;
protected HudModule(String name, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { protected HudModule(String name, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super(name, Group.HUD, builder, dispatcher); super(name, Group.HUD, builder, dispatcher);
this.x = this.option( this.x = Setting.Number.builder()
"x", "horizontal offset", 0, .name("x")
IntegerArgumentType.integer(0), Integer.class, .comment("horizontal offset")
builder, dispatcher .fallback(0)
); .build(builder, dispatcher);
this.y = this.option( this.y = Setting.Number.builder()
"y", "vertical offset", 0, .name("y")
IntegerArgumentType.integer(0), Integer.class, .comment("vertical offset")
builder, dispatcher .fallback(0)
); .build(builder, dispatcher);
this.scale = this.option( this.scale = Setting.Decimal.builder()
"scale", "scale of element", 1.0, .name("scale")
DoubleArgumentType.doubleArg(0.0), Double.class, .comment("scale of element")
builder, dispatcher .fallback(1.0)
); .build(builder, dispatcher);
this.anchor = this.optionEnum( this.anchor = Setting.Switch.builder(Anchor.class)
"anchor", "origin point for coordinates", Anchor.TOPLEFT, .name("anchor")
EnumArgument.enumArgument(Anchor.class), Anchor.class, .comment("origin point for coordinates")
builder, dispatcher .fallback(Anchor.TOPLEFT)
); .build(builder, dispatcher);
} }
protected boolean shouldHide() {
if (ICommons.MC.options.renderDebug) {
return true;
}
return false;
}
} }

View file

@ -56,81 +56,6 @@ public abstract class Module {
return this; return this;
} }
// TODO can I merge these two option into one? Maybe redo with builder pattern?
public <T extends Enum<T>> ForgeConfigSpec.EnumValue<T> optionEnum(
String name,
String comment,
T fallback,
ArgumentType<T> argument,
Class<T> clazz,
ForgeConfigSpec.Builder builder,
CommandDispatcher<CommandSource> dispatcher
) {
ForgeConfigSpec.EnumValue<T> conf = builder
.comment(comment)
.defineEnum(name, fallback);
dispatcher.register(
Commands.literal(this.name.toLowerCase())
.then(
Commands.literal(name)
.then(
Commands.argument(name, argument)
.executes( ctx -> {
T value = ctx.getArgument(name, clazz);
conf.set(value);
conf.save();
log(String.format("> %s -> %s <", String.join(".", conf.getPath()), conf.get().toString()));
return 1;
}))
.executes(ctx -> {
log(String.format("> %s: %s <", String.join(".", conf.getPath()), conf.get().toString()));
return 1;
})
)
);
return conf;
}
public <T> ForgeConfigSpec.ConfigValue<T> option(
String name,
String comment,
T fallback,
ArgumentType<T> argument,
Class<T> clazz,
ForgeConfigSpec.Builder builder,
CommandDispatcher<CommandSource> dispatcher
) {
ForgeConfigSpec.ConfigValue<T> conf = builder
.comment(comment)
.define(name, fallback);
dispatcher.register(
Commands.literal(this.name.toLowerCase())
.then(
Commands.literal(name)
.then(
Commands.argument(name, argument)
.executes( ctx -> {
T value = ctx.getArgument(name, clazz);
conf.set(value);
conf.save();
log(String.format("> %s -> %s <", String.join(".", conf.getPath()), conf.get().toString()));
return 1;
}))
.executes(ctx -> {
log(String.format("> %s: %s <", name, conf.get().toString()));
return 1;
})
)
);
return conf;
}
protected void onEnabled() {} protected void onEnabled() {}
protected void onDisabled() {} protected void onDisabled() {}

View file

@ -5,6 +5,7 @@ import com.mojang.brigadier.arguments.DoubleArgumentType;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -21,17 +22,20 @@ public class Aura extends QuickModule implements ICommons {
public Aura(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public Aura(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("Aura", Group.DEFENSE, UNBOUND, builder, dispatcher); super("Aura", Group.DEFENSE, UNBOUND, builder, dispatcher);
this.reach = this.option( this.reach = Setting.Decimal.builder()
"reach", "aura attack reach", 5., .min(0.)
DoubleArgumentType.doubleArg(0.), Double.class, .fallback(5.)
builder, dispatcher .name("reach")
); .comment("aura attack reach")
.build(builder, dispatcher);
this.strenght = this.option( this.strenght = Setting.Decimal.builder()
"strenght", "minimum strenght required for attack", 1., .min(0.)
DoubleArgumentType.doubleArg(0., 1.), Double.class, .max(1.)
builder, dispatcher .name("strenght")
); .comment("minimum strenght required for attack")
.fallback(1.)
.build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -8,10 +8,10 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.HudModule; import ftbsc.bscv.modules.HudModule;
import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.text.Color; import net.minecraft.util.text.Color;
@ -29,11 +29,11 @@ public class EntityList extends HudModule implements ICommons {
public EntityList(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public EntityList(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("EntityList", builder, dispatcher); super("EntityList", builder, dispatcher);
this.search = this.option( this.search = Setting.Str.builder()
"search", "highlight names containing this text", "", .name("search")
StringArgumentType.string(), String.class, .comment("highlight names containing this text")
builder, dispatcher .fallback("")
); .build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -5,10 +5,10 @@ import static ftbsc.bscv.tools.Text.TextBuilder;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.BoolArgumentType;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.HudModule; import ftbsc.bscv.modules.HudModule;
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;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
@ -47,29 +47,29 @@ public class InfoDisplay extends HudModule implements ICommons {
public InfoDisplay(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public InfoDisplay(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("InfoDisplay", builder, dispatcher); super("InfoDisplay", builder, dispatcher);
this.logo = this.option( this.logo = Setting.Bool.builder()
"logo", "show logo at top of list", true, .name("logo")
BoolArgumentType.bool(), Boolean.class, .comment("show logo at top of list")
builder, dispatcher .fallback(true)
); .build(builder, dispatcher);
this.speed = this.option( this.speed = Setting.Bool.builder()
"speed", "show speed meter", true, .name("speed")
BoolArgumentType.bool(), Boolean.class, .comment("show speed meter")
builder, dispatcher .fallback(true)
); .build(builder, dispatcher);
this.time = this.option( this.time = Setting.Bool.builder()
"time", "show world time", true, .name("time")
BoolArgumentType.bool(), Boolean.class, .comment("show world time")
builder, dispatcher .fallback(true)
); .build(builder, dispatcher);
this.hide_effects = this.option( this.hide_effects = Setting.Bool.builder()
"hide-effects", "hide effect icons on top right corner", false, .name("hide-effects")
BoolArgumentType.bool(), Boolean.class, .comment("hide effect icons on top right corner")
builder, dispatcher .fallback(false)
); .build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent
@ -96,14 +96,14 @@ public class InfoDisplay extends HudModule implements ICommons {
@SubscribeEvent @SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) { public void onRenderOverlay(RenderGameOverlayEvent event) {
if (event.getType() == ElementType.POTION_ICONS) { if (event.getType() == ElementType.POTION_ICONS) {
if (this.hide_effects.get()) { if (this.hide_effects.get() && event.isCancelable()) {
event.setCanceled(true); event.setCanceled(true);
} }
} }
if (event.getType() != ElementType.TEXT) return; if (event.getType() != ElementType.TEXT) return;
if (this.shouldHide()) return;
Minecraft mc = MC;
int offset = 0; int offset = 0;
double scale = this.scale.get(); double scale = this.scale.get();
if (this.logo.get()) { if (this.logo.get()) {
@ -115,13 +115,13 @@ public class InfoDisplay extends HudModule implements ICommons {
.style(Style.EMPTY.withColor(Color.fromRgb(12542314)).withBold(true)) .style(Style.EMPTY.withColor(Color.fromRgb(12542314)).withBold(true))
.scale(scale * 4.0) .scale(scale * 4.0)
.render(event.getMatrixStack(), event.getWindow()); .render(event.getMatrixStack(), event.getWindow());
offset += mc.font.lineHeight * scale * 4.0; offset += MC.font.lineHeight * scale * 4.0;
} }
if (this.time.get()) { if (this.time.get()) {
long daytime = 0; long daytime = 0;
if (mc.level != null) { if (MC.level != null) {
daytime = mc.level.dayTime(); daytime = MC.level.dayTime();
} }
TextBuilder() TextBuilder()
.txt(String.format("> time: %d/1200 (%d day)", (daytime / 20) % 1200, daytime / (20 * 1200) )) .txt(String.format("> time: %d/1200 (%d day)", (daytime / 20) % 1200, daytime / (20 * 1200) ))
@ -130,7 +130,7 @@ public class InfoDisplay extends HudModule implements ICommons {
.y(this.y.get() + offset) .y(this.y.get() + offset)
.scale(scale) .scale(scale)
.render(event.getMatrixStack(), event.getWindow()); .render(event.getMatrixStack(), event.getWindow());
offset += mc.font.lineHeight * scale; offset += MC.font.lineHeight * scale;
} }
if (this.speed.get()) { if (this.speed.get()) {
@ -141,7 +141,7 @@ public class InfoDisplay extends HudModule implements ICommons {
.y(this.y.get() + offset) .y(this.y.get() + offset)
.scale(scale) .scale(scale)
.render(event.getMatrixStack(), event.getWindow()); .render(event.getMatrixStack(), event.getWindow());
offset += mc.font.lineHeight * scale; offset += MC.font.lineHeight * scale;
} }
} }
} }

View file

@ -8,10 +8,10 @@ import ftbsc.bscv.ICommons;
import ftbsc.bscv.events.BoatEvent; import ftbsc.bscv.events.BoatEvent;
import ftbsc.bscv.modules.Module; import ftbsc.bscv.modules.Module;
import ftbsc.bscv.tools.Keyboard; import ftbsc.bscv.tools.Keyboard;
import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.math.vector.Vector2f; import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.Phase;
@ -22,27 +22,49 @@ public class BoatFly extends Module implements ICommons {
public final ForgeConfigSpec.ConfigValue<Double> speed; public final ForgeConfigSpec.ConfigValue<Double> speed;
public final ForgeConfigSpec.ConfigValue<Double> rise; public final ForgeConfigSpec.ConfigValue<Double> rise;
public final ForgeConfigSpec.ConfigValue<Boolean> gravity; public final ForgeConfigSpec.ConfigValue<Boolean> gravity;
public final ForgeConfigSpec.ConfigValue<Boolean> rotation;
public final ForgeConfigSpec.ConfigValue<Boolean> sprint;
public final ForgeConfigSpec.ConfigValue<Boolean> drift;
public BoatFly(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public BoatFly(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("BoatFly", Group.MOTION, builder, dispatcher); super("BoatFly", Group.MOTION, builder, dispatcher);
this.speed = this.option( this.speed = Setting.Decimal.builder()
"speed", "magnitude of boat movement", 1., .fallback(1.)
DoubleArgumentType.doubleArg(), Double.class, .name("speed")
builder, dispatcher .comment("magnitude of boat movement")
); .build(builder, dispatcher);
this.rise = this.option( this.rise = Setting.Decimal.builder()
"rise", "vertical speed", 0.5, .min(0.)
DoubleArgumentType.doubleArg(), Double.class, .fallback(0.5)
builder, dispatcher .name("rise")
); .comment("vertical speed")
.build(builder, dispatcher);
this.gravity = this.option( this.gravity = Setting.Bool.builder()
"gravity", "toggle boat gravity", true, .fallback(true)
BoolArgumentType.bool(), Boolean.class, .name("gravity")
builder, dispatcher .comment("toggle boat gravity")
); .build(builder, dispatcher);
this.rotation = Setting.Bool.builder()
.fallback(true)
.name("rotation")
.comment("rotate boat with player")
.build(builder, dispatcher);
this.sprint = Setting.Bool.builder()
.fallback(true)
.name("sprint")
.comment("halve boat speed while not sprinting")
.build(builder, dispatcher);
this.drift = Setting.Bool.builder()
.fallback(false)
.name("drift")
.comment("allow boat drifting")
.build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,13 +1,11 @@
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 com.mojang.brigadier.arguments.IntegerArgumentType;
import ftbsc.bscv.BoSCoVicino; import ftbsc.bscv.BoSCoVicino;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.tools.Setting;
import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.network.play.client.CPlayerPacket; import net.minecraft.network.play.client.CPlayerPacket;
@ -30,35 +28,39 @@ public class VanillaFlight extends QuickModule implements ICommons {
public VanillaFlight(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public VanillaFlight(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("VanillaFlight", Group.MOTION, UNBOUND, builder, dispatcher); super("VanillaFlight", Group.MOTION, UNBOUND, builder, dispatcher);
this.force = this.option( this.force = Setting.Bool.builder()
"force", "force enable flight on user", false, .name("force")
BoolArgumentType.bool(), Boolean.class, .comment("force enable flight on user")
builder, dispatcher .fallback(false)
); .build(builder, dispatcher);
this.speed = this.option( this.speed = Setting.Decimal.builder()
"speed", "flight speed to set", 0.05, .min(0.)
DoubleArgumentType.doubleArg(0.0), Double.class, .fallback(0.05)
builder, dispatcher .name("speed")
); .comment("flight speed to set")
.build(builder, dispatcher);
this.antikick = this.option( this.antikick = Setting.Bool.builder()
"antikick", "prevent vanilla flight kick by descending", false, .fallback(false)
BoolArgumentType.bool(), Boolean.class, .name("antikick")
builder, dispatcher .comment("prevent vanilla flight kick by descending")
); .build(builder, dispatcher);
this.antikick_magnitude = this.option( this.antikick_magnitude = Setting.Decimal.builder()
"magnitude", "magnitude of antikick push", 1.0, .min(0.)
DoubleArgumentType.doubleArg(0.0), Double.class, .fallback(1.)
builder, dispatcher .name("magnitude")
); .comment("magnitude of antikick push")
.build(builder, dispatcher);
this.antikick_cycle = this.option( this.antikick_cycle = Setting.Number.builder()
"cycle", "how often to run antikick routine", 0, .min(0)
IntegerArgumentType.integer(0, 79), Integer.class, .max(79)
builder, dispatcher .fallback(0)
); .name("cycle")
.comment("how often to run antikick routine")
.build(builder, dispatcher);
} }
private boolean couldFlyBefore = false; private boolean couldFlyBefore = false;

View file

@ -1,11 +1,11 @@
package ftbsc.bscv.modules.self; package ftbsc.bscv.modules.self;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.BoolArgumentType;
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.Module;
import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource; 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;
@ -21,17 +21,17 @@ public class AntiHunger extends Module implements ICommons {
public AntiHunger(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public AntiHunger(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("AntiHunger", Group.SELF, builder, dispatcher); super("AntiHunger", Group.SELF, builder, dispatcher);
this.sprint = this.option( this.sprint = Setting.Bool.builder()
"sprint", "mask sprint toggle packets", true, .fallback(true)
BoolArgumentType.bool(), Boolean.class, .name("sprint")
builder, dispatcher .comment("mask sprint toggle packets")
); .build(builder, dispatcher);
this.hover = this.option( this.hover = Setting.Bool.builder()
"hover", "mark as not on-ground while walking", true, .name("hover")
BoolArgumentType.bool(), Boolean.class, .comment("mark as not on-ground while walking")
builder, dispatcher .fallback(true)
); .build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,11 +1,11 @@
package ftbsc.bscv.modules.self; package ftbsc.bscv.modules.self;
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.events.PacketEvent; import ftbsc.bscv.events.PacketEvent;
import ftbsc.bscv.modules.Module; import ftbsc.bscv.modules.Module;
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;
import net.minecraft.network.play.server.SUpdateHealthPacket; import net.minecraft.network.play.server.SUpdateHealthPacket;
@ -20,11 +20,11 @@ public class AutoDisconnect extends Module implements ICommons {
public AutoDisconnect(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public AutoDisconnect(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("AutoDisconnect", Group.SELF, builder, dispatcher); super("AutoDisconnect", Group.SELF, builder, dispatcher);
this.threshold = this.option( this.threshold = Setting.Decimal.builder()
"threshold", "hp below which connection should be closed", 10., .fallback(10.)
DoubleArgumentType.doubleArg(0., 20.), Double.class, .name("threshold")
builder, dispatcher .comment("hp below which connection should be closed")
); .build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,12 +1,11 @@
package ftbsc.bscv.modules.self; package ftbsc.bscv.modules.self;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.BoolArgumentType;
import com.mojang.brigadier.arguments.LongArgumentType;
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.Module;
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;
import net.minecraft.network.play.server.SPlaySoundEffectPacket; import net.minecraft.network.play.server.SPlaySoundEffectPacket;
@ -18,29 +17,23 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class AutoFish extends Module implements ICommons { public class AutoFish extends Module implements ICommons {
public final ForgeConfigSpec.ConfigValue<Boolean> recast; public final ForgeConfigSpec.ConfigValue<Boolean> recast;
public final ForgeConfigSpec.ConfigValue<Long> 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(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("AutoFish", Group.SELF, builder, dispatcher); super("AutoFish", Group.SELF, builder, dispatcher);
this.recast = this.option( this.recast = Setting.Bool.builder()
"recast", "automatically recast hook after fishing", false, .name("recast")
BoolArgumentType.bool(), Boolean.class, .comment("automatically recast hook after fishing")
builder, dispatcher .fallback(false)
); .build(builder, dispatcher);
this.delay = this.option( this.delay = Setting.Number.builder()
"delay", "how long in ms to wait before recasting hook", 2500L, .fallback(2500)
LongArgumentType.longArg(0), Long.class, .name("delay")
builder, dispatcher .comment("how long in ms to wait before recasting hook")
); .build(builder, dispatcher);
// this.reaction = this.option(
// "reaction", "time in ms to react to fish biting", 0L,
// LongArgumentType.longArg(0), Long.class,
// builder, dispatcher
// );
} }
@SubscribeEvent @SubscribeEvent

View file

@ -3,11 +3,11 @@ package ftbsc.bscv.modules.self;
import java.util.List; import java.util.List;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.Module; import ftbsc.bscv.modules.Module;
import ftbsc.bscv.tools.Inventory; import ftbsc.bscv.tools.Inventory;
import ftbsc.bscv.tools.Setting;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
@ -24,11 +24,11 @@ public class AutoTool extends Module implements ICommons {
public AutoTool(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public AutoTool(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("AutoTool", Group.SELF, builder, dispatcher); super("AutoTool", Group.SELF, builder, dispatcher);
this.limit = this.option( this.limit = Setting.Number.builder()
"limit", "durability limit for tools, set to 0 to destroy them", 1, .name("limit")
IntegerArgumentType.integer(0), Integer.class, .comment("durability limit for tools, set to 0 to destroy them")
builder, dispatcher .fallback(1)
); .build(builder, dispatcher);
} }
private boolean itemIsTooDamaged(ItemStack item) { private boolean itemIsTooDamaged(ItemStack item) {

View file

@ -1,14 +1,13 @@
package ftbsc.bscv.modules.self; package ftbsc.bscv.modules.self;
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.BoSCoVicino; import ftbsc.bscv.BoSCoVicino;
import ftbsc.bscv.events.PacketEvent; import ftbsc.bscv.events.PacketEvent;
import ftbsc.bscv.ICommons; import ftbsc.bscv.ICommons;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.tools.Keyboard; import ftbsc.bscv.tools.Keyboard;
import ftbsc.bscv.tools.Setting;
import net.minecraft.client.entity.player.RemoteClientPlayerEntity; import net.minecraft.client.entity.player.RemoteClientPlayerEntity;
import net.minecraft.client.network.play.NetworkPlayerInfo; import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
@ -33,23 +32,23 @@ public class Freecam extends QuickModule implements ICommons {
public Freecam(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public Freecam(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("Freecam", Group.SELF, UNBOUND, builder, dispatcher); super("Freecam", Group.SELF, UNBOUND, builder, dispatcher);
this.log = this.option( this.log = Setting.Bool.builder()
"log", "log canceled packets", false, .name("log")
BoolArgumentType.bool(), Boolean.class, .comment("log canceled packets")
builder, dispatcher .fallback(false)
); .build(builder, dispatcher);
this.speed = this.option( this.speed = Setting.Decimal.builder()
"speed", "flight speed in freecam", 0.05, .name("speed")
DoubleArgumentType.doubleArg(0.0), Double.class, .comment("flight speed in freecam")
builder, dispatcher .fallback(0.05)
); .build(builder, dispatcher);
this.drift = this.option( this.drift = Setting.Bool.builder()
"drift", "allow inertia drift in freecam", true, .name("drift")
BoolArgumentType.bool(), Boolean.class, .comment("allow inertia drift in freecam")
builder, dispatcher .fallback(true)
); .build(builder, dispatcher);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -3,7 +3,6 @@ package ftbsc.bscv.modules.vision;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.potion.Effect; import net.minecraft.potion.Effect;
@ -17,31 +16,19 @@ import ftbsc.bscv.ICommons;
public class Fullbright extends QuickModule implements ICommons { public class Fullbright extends QuickModule implements ICommons {
private final ForgeConfigSpec.ConfigValue<String> mode;
public Fullbright(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) { public Fullbright(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
super("Fullbright", Group.VISION, KeyEvent.VK_V, builder, dispatcher); super("Fullbright", Group.VISION, KeyEvent.VK_V, builder, dispatcher);
this.mode = this.option(
"mode", "either potion or potion", "potion",
StringArgumentType.string(), String.class,
builder, dispatcher
);
} }
@SubscribeEvent @SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) { public void onTick(TickEvent.ClientTickEvent event) {
if (MC == null) return; if (MC == null) return;
if (MC.player == null) return; if (MC.player == null) return;
if (this.mode.get().equals("potion")) { MC.player.addEffect(new EffectInstance(Effect.byId(16), 5204));
MC.player.addEffect(new EffectInstance(Effect.byId(16), 5204));
}
} }
@Override @Override
protected void onDisabled() { protected void onDisabled() {
if (this.mode.get().equals("potion")) { MC.player.removeEffect(Effect.byId(16));
MC.player.removeEffect(Effect.byId(16));
}
} }
} }