make unloading a bit more unterrible, fix a crash, fix warnings

This commit is contained in:
Daniella / Tove 2024-05-25 21:37:38 +02:00
parent 2c9a14750d
commit e227527eeb
42 changed files with 137 additions and 184 deletions

5
Client/.gitignore vendored
View file

@ -42,8 +42,3 @@ bin/
### Mac OS ### ### Mac OS ###
.DS_Store .DS_Store
run/

View file

@ -4,7 +4,6 @@ import com.baseband.client.init.BaseBand;
import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;

View file

@ -12,7 +12,7 @@ public class ConfigHandle implements SetCommand {
final String name; final String name;
TCN tcn; TCN tcn;
ArrayList<Updater> onUpdate = new ArrayList<>(); final ArrayList<Updater> onUpdate = new ArrayList<>();
public ConfigHandle(String name, TCN tcn) { public ConfigHandle(String name, TCN tcn) {
this.name = name; this.name = name;

View file

@ -12,7 +12,7 @@ public class Configuration {
private Configuration() throws IOException { private Configuration() throws IOException {
} }
private static Configuration INSTANCE; private static final Configuration INSTANCE;
static { static {
try { try {

View file

@ -9,8 +9,8 @@ public class Updater {
final ConfigHandle handle; final ConfigHandle handle;
String id = "*"; String id = "*";
Object o; final Object o;
Field field; final Field field;
Updater(ConfigHandle handle, Object o, Field field) { Updater(ConfigHandle handle, Object o, Field field) {
this.handle = handle; this.handle = handle;

View file

@ -6,9 +6,9 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class AnyGate { public class AnyGate {
Gate gate; final Gate gate;
MultiGate multiGate; final MultiGate multiGate;
Object o; final Object o;
public AnyGate(@Nullable Gate gate, @Nullable MultiGate multiGate, @Nonnull Object o) { public AnyGate(@Nullable Gate gate, @Nullable MultiGate multiGate, @Nonnull Object o) {
this.gate = gate; this.gate = gate;

View file

@ -1,7 +1,5 @@
package com.baseband.client.event; package com.baseband.client.event;
import com.baseband.client.util.misc.GlobalUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -23,7 +21,6 @@ public class EventManager {
for (Method method : methods) { for (Method method : methods) {
Class<?>[] parameterTypes = method.getParameterTypes(); Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length == 1 && Event.class.isAssignableFrom(parameterTypes[0])) { if (parameterTypes.length == 1 && Event.class.isAssignableFrom(parameterTypes[0])) {
//noinspection unchecked
Class<? extends Event> eventType = (Class<? extends Event>) parameterTypes[0]; Class<? extends Event> eventType = (Class<? extends Event>) parameterTypes[0];
List<SubscriberMethod> eventSubscribers = subscribers.getOrDefault(eventType, new ArrayList<>()); List<SubscriberMethod> eventSubscribers = subscribers.getOrDefault(eventType, new ArrayList<>());
eventSubscribers.add(new SubscriberMethod(subscriber, method)); eventSubscribers.add(new SubscriberMethod(subscriber, method));

View file

@ -4,7 +4,7 @@ import com.baseband.client.event.Event;
import net.minecraft.entity.MoverType; import net.minecraft.entity.MoverType;
public class MoveEvent extends Event { public class MoveEvent extends Event {
public MoverType type; public final MoverType type;
public double x; public double x;
public double y; public double y;
public double z; public double z;

View file

@ -27,9 +27,6 @@ public class GuiRewrite extends GuiScreen {
public GuiRewrite() { public GuiRewrite() {
this.mc = BaseBand.mc; this.mc = BaseBand.mc;
ClickGUI clickGUI = BaseBand.getFeature(ClickGUI.class);
if(!clickGUI.enabled)
clickGUI.toggle();
createComponents(); createComponents();
} }
@ -92,6 +89,7 @@ public class GuiRewrite extends GuiScreen {
BaseBand.getFeature(ClickGUI.class).setEnabled(false); BaseBand.getFeature(ClickGUI.class).setEnabled(false);
for (Category category : categories) { for (Category category : categories) {
com.baseband.client.module.Category c = com.baseband.client.module.Category.fromName(category.text); com.baseband.client.module.Category c = com.baseband.client.module.Category.fromName(category.text);
assert c != null;
c.show = category.subComponentsShown; c.show = category.subComponentsShown;
c.x = category.location.getX(); c.x = category.location.getX();
c.y = category.location.getY(); c.y = category.location.getY();

View file

@ -29,8 +29,7 @@ public class Category extends Component {
fontRenderer.drawString(text, x, y.get(), green ? GUIManager.fontColorOn : GUIManager.fontColorOff); fontRenderer.drawString(text, x, y.get(), green ? GUIManager.fontColorOn : GUIManager.fontColorOff);
y.addAndGet(size()); y.addAndGet(size());
if(subComponentsShown) { if(subComponentsShown) {
for (int i = 0 ; i < subComponents.size() ; i++) { for (Component component : subComponents) {
Component component = subComponents.get(i);
component.render(x, y, 0, false, component.size()); component.render(x, y, 0, false, component.size());
} }
} }

View file

@ -27,8 +27,8 @@ public abstract class Component {
public Point loc; public Point loc;
private AnyGate visibilityGate = null; private AnyGate visibilityGate = null;
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
public ArrayList<Component> subComponents = new ArrayList<>(); public final ArrayList<Component> subComponents = new ArrayList<>();
public String text = ""; public String text = "";
public boolean green = false; public boolean green = false;

View file

@ -4,9 +4,9 @@ import com.baseband.client.configuration.ConfigHandle;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
public class KeyButton extends Button { public class KeyButton extends Button {
protected String name; protected final String name;
protected ConfigHandle handle; protected final ConfigHandle handle;
protected String field; protected final String field;
public KeyButton(String name, ConfigHandle handle, String field) { public KeyButton(String name, ConfigHandle handle, String field) {
super(name + ": " + (handle.getContent().get(field) != null ? Keyboard.getKeyName(handle.getContent().getInteger(field)) : "NONE"), it -> ((KeyButton) it).press()); super(name + ": " + (handle.getContent().get(field) != null ? Keyboard.getKeyName(handle.getContent().getInteger(field)) : "NONE"), it -> ((KeyButton) it).press());

View file

@ -4,9 +4,9 @@ import com.baseband.client.configuration.ConfigHandle;
import com.baseband.client.module.command.Set; import com.baseband.client.module.command.Set;
public class StringButton extends Button { public class StringButton extends Button {
protected String name; protected final String name;
protected ConfigHandle handle; protected final ConfigHandle handle;
protected String field; protected final String field;
public StringButton(String name, ConfigHandle handle, String field) { public StringButton(String name, ConfigHandle handle, String field) {
super(name + ": --UNINIT", new ClickEvent() { super(name + ": --UNINIT", new ClickEvent() {

View file

@ -7,7 +7,7 @@ import com.baseband.client.util.misc.GlobalUtil;
public class ToggleButton extends Component { public class ToggleButton extends Component {
protected ConfigHandle handle; protected ConfigHandle handle;
protected String field; protected final String field;
private Runnable lambda; private Runnable lambda;
public ToggleButton(String s, ConfigHandle handle, String field) { public ToggleButton(String s, ConfigHandle handle, String field) {

View file

@ -23,7 +23,7 @@ public class BaseBand {
private static boolean finishedDisabling = false; private static boolean finishedDisabling = false;
public static String buildString = "Broadway"; public static String buildString = "Broadway";
public static final EventManager eventManager = new EventManager(); public static final EventManager eventManager = new EventManager();
public static FMLEventHandler fmlEventHandlerInstance = new FMLEventHandler(); public static final FMLEventHandler fmlEventHandlerInstance = new FMLEventHandler();
public static boolean disabled = false; public static boolean disabled = false;
public static Minecraft mc; public static Minecraft mc;
@ -62,7 +62,7 @@ public class BaseBand {
} }
for (Updater updater : updaters) { for (Updater updater : updaters) {
GlobalUtil.LOGGER.info("populating updater " + updater); GlobalUtil.LOGGER.info("populating updater {}", updater);
updater.populate(); updater.populate();
} }
@ -100,7 +100,6 @@ public class BaseBand {
Feature[] features = Setup.get().Features; Feature[] features = Setup.get().Features;
for (Feature feature : features) { for (Feature feature : features) {
if (feature.getClass() == clazz) if (feature.getClass() == clazz)
//noinspection unchecked untrue
return (T) feature; return (T) feature;
} }
return null; return null;

View file

@ -16,7 +16,7 @@ import java.util.Map;
@Mixin(NetworkRegistry.class) @Mixin(NetworkRegistry.class)
public class MixinFMLNetworkRegistry { public class MixinFMLNetworkRegistry {
@Shadow(remap = false) @Shadow(remap = false)
private EnumMap<Side,Map<String,FMLEmbeddedChannel>> channels = Maps.newEnumMap(Side.class); private final EnumMap<Side,Map<String,FMLEmbeddedChannel>> channels = Maps.newEnumMap(Side.class);
@Overwrite(remap = false) @Overwrite(remap = false)
public EnumMap<Side,FMLEmbeddedChannel> newChannel(ModContainer container, String name, ChannelHandler... handlers) public EnumMap<Side,FMLEmbeddedChannel> newChannel(ModContainer container, String name, ChannelHandler... handlers)

View file

@ -7,7 +7,6 @@ import com.baseband.client.module.category.*;
import com.baseband.client.util.misc.FieldFinder; import com.baseband.client.util.misc.FieldFinder;
import com.baseband.client.util.misc.Marker; import com.baseband.client.util.misc.Marker;
import javax.annotation.Nonnull;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
public enum Category { public enum Category {
@ -36,8 +35,9 @@ public enum Category {
} }
} }
private Class<? extends Annotation> annotationClass; private final Class<? extends Annotation> annotationClass;
private ConfigHandle handle; @SuppressWarnings("FieldCanBeLocal")
private final ConfigHandle handle;
@Marker(1) @Marker(1)
public int x; public int x;
@Marker(2) @Marker(2)
@ -51,7 +51,6 @@ public enum Category {
return name; return name;
} }
@Nonnull
public static Category fromName(String s) { public static Category fromName(String s) {
for (Category c : values()) { for (Category c : values()) {
if(c.name.equals(s)) if(c.name.equals(s))

View file

@ -31,7 +31,7 @@ public class ChatAppend extends Feature {
@Config("CustomText") @Config("CustomText")
@Gate(0) @Gate(0)
public String customWatermark = "baseband"; public final String customWatermark = "baseband";
@Config("CustomTextUnicode") @Config("CustomTextUnicode")
@Gate(0) @Gate(0)

View file

@ -43,14 +43,14 @@ public class ChatCrypt extends Feature {
} }
@Config("Notification mode") @Config("Notification mode")
public NotifMode mode = NotifMode.Chat; public final NotifMode mode = NotifMode.Chat;
@Config("Send") @Config("Send")
public boolean send; public boolean send;
@Config("Use SBE algorithm (preferred)") @Config("Use SBE algorithm (preferred)")
@Marker(1) @Marker(1)
public boolean useSBE = true; public final boolean useSBE = true;
@Marker(2) @Marker(2)
public boolean useTrypt = false; public boolean useTrypt = false;
@ -61,17 +61,17 @@ public class ChatCrypt extends Feature {
@Config("Seed") @Config("Seed")
@Range("-4096..4096") @Range("-4096..4096")
public int seed = 256; public final int seed = 256;
@Config("Box Size") @Config("Box Size")
@Range("256..4096") @Range("256..4096")
@Gate(1) @Gate(1)
public int boxSize = 256; public final int boxSize = 256;
@Config("Keep Trypt instance") @Config("Keep Trypt instance")
@Gate(2) @Gate(2)
@Marker(3) @Marker(3)
public boolean keepTrypt = false; public final boolean keepTrypt = false;
@Config("Warning! More secure, worse QOL") @Config("Warning! More secure, worse QOL")
@MultiGate(and = {3, -2}) @MultiGate(and = {3, -2})
@ -80,17 +80,16 @@ public class ChatCrypt extends Feature {
@Config("Reset Trypt") @Config("Reset Trypt")
@MultiGate(and = {2, 3}) @MultiGate(and = {2, 3})
public Button.ClickEvent resetTrypt = btn -> { public Button.ClickEvent resetTrypt = btn -> trypt = null;
trypt = null;
};
private Trypt trypt; private Trypt trypt;
private final Pattern CHAT_PATTERN = Pattern.compile("(<.*?> )|(.*?: )"); private final Pattern CHAT_PATTERN = Pattern.compile("(<.*?> )|(.*?: )");
@Config("Password") @Config("Password")
public String password = "CLICK HERE"; public final String password = "CLICK HERE";
@SuppressWarnings("ConstantValue")
public void onEnable() { public void onEnable() {
if(password.isEmpty() || password.equalsIgnoreCase("CLICK HERE")) { if(password.isEmpty() || password.equalsIgnoreCase("CLICK HERE")) {
toggle(); toggle();
@ -205,8 +204,8 @@ public class ChatCrypt extends Feature {
} }
} }
char[] table = "!#$%&'()*+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~¡¢£¥¦«²³¹»ÆÇÈÉÊÑÒÓÖÙÚÜßàáäåæçèéêñòóöùü×".toCharArray(); final char[] table = "!#$%&'()*+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~¡¢£¥¦«²³¹»ÆÇÈÉÊÑÒÓÖÙÚÜßàáäåæçèéêñòóöùü×".toCharArray();
byte[] rtable = new byte[256]; final byte[] rtable = new byte[256];
{ {
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
rtable[table[i]] = (byte) i; rtable[table[i]] = (byte) i;

View file

@ -11,13 +11,13 @@ import net.minecraftforge.common.MinecraftForge;
public class Client extends Feature { public class Client extends Feature {
@Config("Prefix") @Config("Prefix")
public String prefix = "&"; public final String prefix = "&";
@Config("ScreenshotUpload") @Config("ScreenshotUpload")
public boolean screenshotUpload; public boolean screenshotUpload;
@Config("Theme") @Config("Theme")
public GuiTheme.Theme theme = GuiTheme.Theme.TTC; public final GuiTheme.Theme theme = GuiTheme.Theme.TTC;
public GuiTheme.ITheme getTheme() { public GuiTheme.ITheme getTheme() {
return theme; return theme;

View file

@ -7,7 +7,6 @@ import com.baseband.client.module.combat.AutoKill;
import com.baseband.client.module.world.Selection; import com.baseband.client.module.world.Selection;
import com.baseband.client.util.config.PlayerDB; import com.baseband.client.util.config.PlayerDB;
import com.baseband.client.util.ingame.ChatUtil; import com.baseband.client.util.ingame.ChatUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -15,6 +14,7 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.RenderWorldLastEvent;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
@Client @Client
@ -22,17 +22,11 @@ public class MidClick extends Feature {
public enum PlayerAction { public enum PlayerAction {
None((p) -> {}), None((p) -> {}),
Target((p) -> { Target((p) -> Objects.requireNonNull(PlayerDB.player(p.getGameProfile().getId(), p.getGameProfile().getName())).set("isTarget", true)),
PlayerDB.player(p.getGameProfile().getId(), p.getGameProfile().getName()).set("isTarget", true); Friend((p) -> Objects.requireNonNull(PlayerDB.player(p.getGameProfile().getId(), p.getGameProfile().getName())).set("isFriend", true)),
}), Message((p) -> ChatUtil.openChat("/w " + p.getGameProfile().getName() + " ")),
Friend((p) -> {
PlayerDB.player(p.getGameProfile().getId(), p.getGameProfile().getName()).set("isFriend", true);
}),
Message((p) -> {
ChatUtil.openChat("/w " + p.getGameProfile().getName() + " ");
}),
; ;
public Consumer<EntityPlayer> action; public final Consumer<EntityPlayer> action;
PlayerAction(Consumer<EntityPlayer> action) { PlayerAction(Consumer<EntityPlayer> action) {
this.action = action; this.action = action;
} }
@ -44,11 +38,9 @@ public class MidClick extends Feature {
Selection.begin = b; Selection.begin = b;
Selection.end = b; Selection.end = b;
}), }),
Corner((b) -> { Corner(Selection::select),
Selection.select(b);
}),
; ;
public Consumer<BlockPos> action; public final Consumer<BlockPos> action;
BlockAction(Consumer<BlockPos> action) { BlockAction(Consumer<BlockPos> action) {
this.action = action; this.action = action;
} }
@ -56,24 +48,22 @@ public class MidClick extends Feature {
public enum EntityAction { public enum EntityAction {
None((e) -> {}), None((e) -> {}),
Target((e) -> { Target((e) -> AutoKill.prioritizedTarget = e),
AutoKill.prioritizedTarget = e;
}),
; ;
public Consumer<EntityLivingBase> action; public final Consumer<EntityLivingBase> action;
EntityAction(Consumer<EntityLivingBase> action) { EntityAction(Consumer<EntityLivingBase> action) {
this.action = action; this.action = action;
} }
} }
@Config("PlayerAction") @Config("PlayerAction")
public PlayerAction playerAction = PlayerAction.Message; public final PlayerAction playerAction = PlayerAction.Message;
@Config("BlockAction") @Config("BlockAction")
public BlockAction blockAction = BlockAction.Corner; public final BlockAction blockAction = BlockAction.Corner;
@Config("EntityAction") @Config("EntityAction")
public EntityAction entityAction = EntityAction.Target; public final EntityAction entityAction = EntityAction.Target;
public void onRender(RenderWorldLastEvent event) { public void onRender(RenderWorldLastEvent event) {
doCheck(); doCheck();
@ -97,9 +87,7 @@ public class MidClick extends Feature {
return; return;
} }
} }
if(hover.getBlockPos() != null) { blockAction.action.accept(hover.getBlockPos());
blockAction.action.accept(hover.getBlockPos());
}
} }
} }

View file

@ -17,21 +17,21 @@ import java.util.ArrayList;
public class AutoKill extends Feature { public class AutoKill extends Feature {
public static EntityLivingBase prioritizedTarget; public static EntityLivingBase prioritizedTarget;
public AutoHit autoHit = new AutoHit(); public final AutoHit autoHit = new AutoHit();
public AutoCrystal autoCrystal = new AutoCrystal(); public final AutoCrystal autoCrystal = new AutoCrystal();
public static AutoKill INSTANCE; { INSTANCE = this; } public static AutoKill INSTANCE; { INSTANCE = this; }
@Config("Attack non-players") @Config("Attack non-players")
public boolean attackEntities = false; public final boolean attackEntities = false;
@Config("Attack players") @Config("Attack players")
@Marker(1) @Marker(1)
public boolean attackPlayers = false; public final boolean attackPlayers = false;
@Config("Attack targets") @Config("Attack targets")
@Gate(1) @Gate(1)
public boolean attackTargets = true; public final boolean attackTargets = true;
ArrayList<EntityLivingBase> getAttackable() { ArrayList<EntityLivingBase> getAttackable() {
ArrayList<EntityLivingBase> allowed = new ArrayList<>(); ArrayList<EntityLivingBase> allowed = new ArrayList<>();

View file

@ -57,64 +57,64 @@ public class AutoTotem extends Feature {
/// GATES END /// GATES END
@Config("Render totem amount") @Config("Render totem amount")
public boolean renderTots = true; public final boolean renderTots = true;
@Config("Mode") @Config("Mode")
public Mode mode = Mode.Hypermove; public final Mode mode = Mode.Hypermove;
/// CONFIG FOR SINGLE /// CONFIG FOR SINGLE
@Config("Use swap instead of click") @Config("Use swap instead of click")
@Gate(M_SINGLE) @Gate(M_SINGLE)
@Marker(M_SINGLESTACK) @Marker(M_SINGLESTACK)
public boolean preferSwap = false; public final boolean preferSwap = false;
/// CONFIG FOR HYPERSWITCH /// CONFIG FOR HYPERSWITCH
@Config("Speed (ticks/switch)") @Config("Speed (ticks/switch)")
@Range("1..10") @Range("1..10")
@Gate(M_HYPERSWITCH) @Gate(M_HYPERSWITCH)
public int hCooldownAmount = 4 ; public final int hCooldownAmount = 4 ;
/// CONFIG FOR ^+HYPERSWAP /// CONFIG FOR ^+HYPERSWAP
@Config("Hotbar slots to use") @Config("Hotbar slots to use")
@Range("1..4") @Range("1..4")
@Gate(M_HYPERSWAP) @Gate(M_HYPERSWAP)
public int hotbarSlots = 2; public final int hotbarSlots = 2;
@Config("Replenish rate (ticks)") @Config("Replenish rate (ticks)")
@Range("3..20") @Range("3..20")
@Gate(M_HYPERSWAP) @Gate(M_HYPERSWAP)
public int replenishRate = 7; public final int replenishRate = 7;
@Config("Redownload inventory") @Config("Redownload inventory")
@Gate(M_HYPERSWAP) @Gate(M_HYPERSWAP)
public boolean redownload = true; public final boolean redownload = true;
@Config("Stacked totems") @Config("Stacked totems")
@Gate(M_HYPERSWAP) @Gate(M_HYPERSWAP)
@Marker(M_HYPERSWAP_STACK) @Marker(M_HYPERSWAP_STACK)
public boolean hsStacked = false; public final boolean hsStacked = false;
/// CONFIG FOR STACK /// CONFIG FOR STACK
@Config("Prep count") @Config("Prep count")
@Range("0..15") @Range("0..15")
@Gate(M_STACK) @Gate(M_STACK)
public int prepCount = 3; public final int prepCount = 3;
@Config("Switch count") @Config("Switch count")
@Range("0..15") @Range("0..15")
@MultiGate(or = {M_STACK, M_HYPERSWAP_STACK}) @MultiGate(or = {M_STACK, M_HYPERSWAP_STACK})
public int switchCount = 4; public final int switchCount = 4;
/// MULTI /// MULTI
@Config("Cooldown (ms)") @Config("Cooldown (ms)")
@Range("0..1000") @Range("0..1000")
@MultiGate(or = {M_STACK, M_SINGLESTACK}) @MultiGate(or = {M_STACK, M_SINGLESTACK})
public int sCooldownAmount = 200; public final int sCooldownAmount = 200;
@ -150,7 +150,7 @@ public class AutoTotem extends Feature {
ArrayList<Integer> totemSlots = new ArrayList<>(); ArrayList<Integer> totemSlots = new ArrayList<>();
int cooldown = 0; int cooldown = 0;
Lock cooldownLock = new Lock(); final Lock cooldownLock = new Lock();
boolean inCooldown = false; boolean inCooldown = false;
int originalStackSlot = -1; int originalStackSlot = -1;
@ -300,10 +300,6 @@ public class AutoTotem extends Feature {
} }
int slot = findStackSlot(); int slot = findStackSlot();
// we know we have totems
//if(slot == -1) {
// return;
//}
InventoryUtils.swapWithHB(slot, 8); InventoryUtils.swapWithHB(slot, 8);
originalStackSlot = slot; originalStackSlot = slot;

View file

@ -22,9 +22,4 @@ public class Test extends Feature {
public String toString() { public String toString() {
return "Test"; return "Test";
} }
@Override
protected void setup() {
}
} }

View file

@ -32,34 +32,34 @@ public class ElytraFly extends Feature {
@Config("HSpeed") @Config("HSpeed")
@Range("1..50") @Range("1..50")
public int hSpeed = 10; public final int hSpeed = 10;
@Config("VSpeed") @Config("VSpeed")
@Range("1..50") @Range("1..50")
public int vSpeed = 10; public final int vSpeed = 10;
@Config("Auto Takeoff") @Config("Auto Takeoff")
@Marker(1) @Marker(1)
public boolean autoTakeoff = false; public final boolean autoTakeoff = false;
@Config("Post-Takeoff Motion") @Config("Post-Takeoff Motion")
@Range("0..3") @Range("0..3")
@Gate(1) @Gate(1)
public float takeoffMotion = 0.3f; public final float takeoffMotion = 0.3f;
@Config("Takeoff Ticks") @Config("Takeoff Ticks")
@Range("1..40") @Range("1..40")
@Gate(1) @Gate(1)
public int takeoffTicks = 1; public final int takeoffTicks = 1;
@Config("Takeoff Gate Mode") @Config("Takeoff Gate Mode")
@Gate(1) @Gate(1)
public GateMode gateMode = GateMode.Packet; public final GateMode gateMode = GateMode.Packet;
@Config("Takeoff Gate Motion") @Config("Takeoff Gate Motion")
@Range("0..0.5") @Range("0..0.5")
@MultiGate(and = {1, 2}) @MultiGate(and = {1, 2})
public float takeoffGateMotion = 0.1f; public final float takeoffGateMotion = 0.1f;
@Marker(2) @Marker(2)
boolean gateModeIsMotion = false; boolean gateModeIsMotion = false;
@ -69,7 +69,7 @@ public class ElytraFly extends Feature {
double takeoffLastPacketY = Double.MIN_VALUE; double takeoffLastPacketY = Double.MIN_VALUE;
boolean takeoffNextTick = false; boolean takeoffNextTick = false;
// for automatically jumping to start a takeoff // for automatically jumping to start a takeoff
Lock takeoff = new Lock(); final Lock takeoff = new Lock();
boolean init = false; boolean init = false;
boolean wasOnGround = true; boolean wasOnGround = true;

View file

@ -8,7 +8,7 @@ import com.baseband.client.module.category.Render;
@Render @Render
public class ClickGUI extends Feature { public class ClickGUI extends Feature {
public GuiRewrite guiRewrite = new GuiRewrite(); public static final GuiRewrite guiRewrite = new GuiRewrite();
public enum SaveExpandedMode { public enum SaveExpandedMode {
Always, Always,
@ -18,13 +18,13 @@ public class ClickGUI extends Feature {
@Config("Break on windows") @Config("Break on windows")
@Gate(Integer.MIN_VALUE) @Gate(Integer.MIN_VALUE)
public boolean breakWindows = true; public final boolean breakWindows = true;
@Config("Mouse Fix") @Config("Mouse Fix")
public boolean mouseFix; public boolean mouseFix;
@Config("Save expanded features") @Config("Save expanded features")
public SaveExpandedMode saveExpanded = SaveExpandedMode.Always; public final SaveExpandedMode saveExpanded = SaveExpandedMode.Always;
@Override @Override
public String toString() { public String toString() {

View file

@ -24,10 +24,10 @@ import java.util.Date;
@Render @Render
public class HUD extends Feature { public class HUD extends Feature {
public static ArrayList<Notification> notifs = new ArrayList<>(); public static final ArrayList<Notification> notifs = new ArrayList<>();
public static class Notification { public static class Notification {
public String text; public final String text;
private final int time; private final int time;
private final long start = new Date().getTime(); private final long start = new Date().getTime();
@ -71,11 +71,11 @@ public class HUD extends Feature {
@Config("Notifications") @Config("Notifications")
@Marker(1) @Marker(1)
public boolean notifications = true; public final boolean notifications = true;
@Config("Notification location") @Config("Notification location")
@Gate(1) @Gate(1)
public NotificationLocation nLocation = NotificationLocation.Center; public final NotificationLocation nLocation = NotificationLocation.Center;
@Config("Advanced") @Config("Advanced")
@Gate(1) @Gate(1)
@ -85,17 +85,17 @@ public class HUD extends Feature {
@Config("Notification size X") @Config("Notification size X")
@Range("2..6") @Range("2..6")
@MultiGate(and = {1, 2}) @MultiGate(and = {1, 2})
public int nSize = 3; public final int nSize = 3;
@Config("Notification size Y") @Config("Notification size Y")
@Range("1..4") @Range("1..4")
@MultiGate(and = {1, 2}) @MultiGate(and = {1, 2})
public int nVSize = 2; public final int nVSize = 2;
@Config("Notification spacing") @Config("Notification spacing")
@Range("0..20") @Range("0..20")
@MultiGate(and = {1, 2}) @MultiGate(and = {1, 2})
public int nVSpace = 5; public final int nVSpace = 5;
@Config("Test!") @Config("Test!")
@Gate(1) @Gate(1)

View file

@ -53,7 +53,7 @@ public class Nametags extends Feature {
} }
@SubscribeEvent @SubscribeEvent
public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre event) { public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre<?> event) {
if (event.getEntity() instanceof EntityPlayer) { if (event.getEntity() instanceof EntityPlayer) {
event.setCanceled(true); event.setCanceled(true);
} }
@ -62,7 +62,7 @@ public class Nametags extends Feature {
private void renderNametag(EntityPlayer player, double x, double y, double z) { private void renderNametag(EntityPlayer player, double x, double y, double z) {
GL11.glPushMatrix(); GL11.glPushMatrix();
String name = player.getName() + "\u00A7a " + MathHelper.ceil(player.getHealth() + player.getAbsorptionAmount()); String name = player.getName() + "§a " + MathHelper.ceil(player.getHealth() + player.getAbsorptionAmount());
name = name.replace(".0", ""); name = name.replace(".0", "");
float var14 = 0.016666668F * getNametagSize(player); float var14 = 0.016666668F * getNametagSize(player);
@ -86,11 +86,11 @@ public class Nametags extends Feature {
} }
} }
Object renderStack; ItemStack renderStack;
if (player.getHeldItemMainhand() != null) { if (player.getHeldItemMainhand() != null) {
xOffset -= 8; xOffset -= 8;
renderStack = player.getHeldItemMainhand().copy(); renderStack = player.getHeldItemMainhand().copy();
renderItem((ItemStack) renderStack, xOffset, -10); renderItem(renderStack, xOffset, -10);
xOffset += 16; xOffset += 16;
} }
for (int index = 3; index >= 0; --index) { for (int index = 3; index >= 0; --index) {
@ -105,11 +105,9 @@ public class Nametags extends Feature {
ItemStack renderOffhand; ItemStack renderOffhand;
if (player.getHeldItemOffhand() != null) { if (player.getHeldItemOffhand() != null) {
xOffset -= 0;
renderOffhand = player.getHeldItemOffhand().copy(); renderOffhand = player.getHeldItemOffhand().copy();
renderItem(renderOffhand, xOffset, -10); renderItem(renderOffhand, xOffset, -10);
xOffset += 8;
} }
GL11.glEnable(GL_TEXTURE_2D); GL11.glEnable(GL_TEXTURE_2D);
@ -172,10 +170,10 @@ public class Nametags extends Feature {
private void renderEnchantText(ItemStack stack, int x, int y) { private void renderEnchantText(ItemStack stack, int x, int y) {
int encY = y - 24; int encY = y - 24;
int yCount = encY - -5; int yCount = encY + 5;
if (stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemSword if (stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemSword
|| stack.getItem() instanceof ItemTool) { || stack.getItem() instanceof ItemTool) {
mc.fontRenderer.drawStringWithShadow(stack.getMaxDamage() - stack.getItemDamage() + "\u00A74", x * 2 + 8, y + 26, mc.fontRenderer.drawStringWithShadow(stack.getMaxDamage() - stack.getItemDamage() + "§4", x * 2 + 8, y + 26,
-1); -1);
} }
NBTTagList enchants = stack.getEnchantmentTagList(); NBTTagList enchants = stack.getEnchantmentTagList();

View file

@ -12,14 +12,14 @@ public class AutoSignText extends Feature {
} }
@Config("Line 1") @Config("Line 1")
public String signTextFirst = "Try editing this"; public final String signTextFirst = "Try editing this";
@Config("Line 2") @Config("Line 2")
public String signTextSecond = "In the GUI!"; public final String signTextSecond = "In the GUI!";
@Config("Line 3") @Config("Line 3")
public String signTextThird = "Try editing this"; public final String signTextThird = "Try editing this";
@Config("Line 4") @Config("Line 4")
public String signTextFourth = "In the GUI!"; public final String signTextFourth = "In the GUI!";
} }

View file

@ -6,10 +6,10 @@ import org.lwjgl.input.Keyboard;
import static com.baseband.client.init.BaseBand.mc; import static com.baseband.client.init.BaseBand.mc;
public class KeyBind { public class KeyBind {
public Integer key = null; public Integer key;
public boolean down = false; public boolean down = false;
public Runnable onPress; public final Runnable onPress;
public Feature dependsOn; public final Feature dependsOn;
public KeyBind(Integer key, Runnable onPress, Feature dependsOn) { public KeyBind(Integer key, Runnable onPress, Feature dependsOn) {
this.key = key; this.key = key;

View file

@ -18,8 +18,8 @@ import javax.annotation.Nonnull;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class FreecamPlayer extends EntityOtherPlayerMP public class FreecamPlayer extends EntityOtherPlayerMP
{ {
public MovementInput movementInput; public final MovementInput movementInput;
protected Minecraft mc; protected final Minecraft mc;
protected final EntityPlayerSP original; protected final EntityPlayerSP original;
public FreecamPlayer(EntityPlayerSP playerSP, World world) public FreecamPlayer(EntityPlayerSP playerSP, World world)

View file

@ -16,7 +16,7 @@ import java.net.URLEncoder;
import java.util.Base64; import java.util.Base64;
public class ScreenshotHelper extends Thread { public class ScreenshotHelper extends Thread {
BufferedImage image; final BufferedImage image;
public ScreenshotHelper(BufferedImage bufferedImage) { public ScreenshotHelper(BufferedImage bufferedImage) {
this.image = bufferedImage; this.image = bufferedImage;

View file

@ -12,45 +12,46 @@ public class FieldFinder {
@Nonnull @Nonnull
public static Field findMarked(Class<?> clazz, int id) { public static Field findMarked(Class<?> clazz, int id) {
Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
for (int i = 0; i < fields.length; i++) { for (Field field : fields) {
Marker marker = fields[i].getDeclaredAnnotation(Marker.class); Marker marker = field.getDeclaredAnnotation(Marker.class);
if(marker != null && marker.value() == id) { if (marker != null && marker.value() == id) {
ReflectUtil.forceAccessible(fields[i]); ReflectUtil.forceAccessible(field);
return fields[i]; return field;
} }
} }
if(clazz.getSuperclass() != null) if(clazz.getSuperclass() != null)
return findMarked(clazz.getSuperclass(), id); return findMarked(clazz.getSuperclass(), id);
return null; throw new IllegalArgumentException("field " + id + " does not exist in " + clazz);
} }
@Nonnull
public static Field findUnmarked(Class<?> clazz, Class<?> type, int id) { public static Field findUnmarked(Class<?> clazz, Class<?> type, int id) {
Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
int n = 0; int n = 0;
for (int i = 0; i < fields.length; i++) { for (Field field : fields) {
if(fields[i].getType() == type) { if (field.getType() == type) {
if(n++ == id) { if (n++ == id) {
ReflectUtil.forceAccessible(fields[i]); ReflectUtil.forceAccessible(field);
return fields[i]; return field;
} }
} }
} }
return null; throw new IllegalArgumentException("field " + id + " of " + type + " does not exist in " + clazz);
} }
@Nonnull
public static Method findUnmarkedMethod(Class<?> clazz, int id, Class<?>... args) { public static Method findUnmarkedMethod(Class<?> clazz, int id, Class<?>... args) {
Method[] declaredMethods = clazz.getDeclaredMethods(); Method[] declaredMethods = clazz.getDeclaredMethods();
int n = 0; int n = 0;
for (int i = 0 ; i < declaredMethods.length ; i++) { for (Method m : declaredMethods) {
Method m = declaredMethods[i]; if (Arrays.equals(m.getParameterTypes(), args)) {
if(Arrays.equals(m.getParameterTypes(), args)) { if (n++ == id) {
if(n++ == id) {
ReflectUtil.forceAccessible(m); ReflectUtil.forceAccessible(m);
return m; return m;
} }
} }
} }
return null; throw new IllegalArgumentException("method " + id + " with args " + Arrays.toString(args) + " does not exist in " + clazz);
} }
} }

View file

@ -10,7 +10,7 @@ import java.util.Random;
public class SBE { public class SBE {
private static final short blockSize = 128; private static final short blockSize = 128;
private byte[] key; private final byte[] key;
private int[] box; private int[] box;
public SBE(byte[] key, int boxSize, long seed) { public SBE(byte[] key, int boxSize, long seed) {

View file

@ -1,17 +1,14 @@
package com.baseband.client.util.misc; package com.baseband.client.util.misc;
import de.tudbut.tools.StringTools;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random; import java.util.Random;
public class Trypt { public class Trypt {
SecureRandom sRand = new SecureRandom(); final SecureRandom sRand = new SecureRandom();
Random cRandE; final Random cRandE;
Random cRandD; final Random cRandD;
byte[] key; final byte[] key;
public Trypt(long seed, byte[] key) { public Trypt(long seed, byte[] key) {
cRandE = new Random(seed); cRandE = new Random(seed);

View file

@ -7,6 +7,7 @@ import de.tudbut.net.ws.ConnectionHandler;
import java.io.IOException; import java.io.IOException;
public class WebServiceClient { public class WebServiceClient {
@SuppressWarnings("FieldCanBeLocal") // not finished yet
private static Client client; private static Client client;
public static void connect() { public static void connect() {

View file

@ -6,7 +6,6 @@
package old.baseband.installer; package old.baseband.installer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.UUID;
public class Key { public class Key {
//Daniella made the actual encryption, //Daniella made the actual encryption,

View file

@ -13,8 +13,6 @@ public class MinecraftFiles {
public static String getMinecraftMods() { public static String getMinecraftMods() {
String minecraft = null; String minecraft = null;
assert os != null;
if (os.contains("nux")) { if (os.contains("nux")) {
minecraft = System.getProperty("user.home") + "/.minecraft/mods/"; minecraft = System.getProperty("user.home") + "/.minecraft/mods/";
} else if (os.contains("darwin") || os.contains("mac")) { } else if (os.contains("darwin") || os.contains("mac")) {

View file

@ -15,7 +15,7 @@ import java.util.Map;
//TODO: insecure tud please rewrite //TODO: insecure tud please rewrite
public class CustomClassLoader extends ClassLoader implements Util { public class CustomClassLoader extends ClassLoader implements Util {
Map<String, byte[]> resources; final Map<String, byte[]> resources;
public CustomClassLoader(Map<String, byte[]> resources) { public CustomClassLoader(Map<String, byte[]> resources) {
this.resources = resources; this.resources = resources;
@ -47,8 +47,7 @@ public class CustomClassLoader extends ClassLoader implements Util {
@Override @Override
protected URL findResource(String name) { protected URL findResource(String name) {
if (name.endsWith(".class")) { if (name.endsWith(".class")) {
URL launchCLResponse = Launch.classLoader.findResource(name); return Launch.classLoader.findResource(name);
return launchCLResponse;
} }
if (name.startsWith("assets/minecraft") && !name.startsWith("assets/minecraft/texts")) { if (name.startsWith("assets/minecraft") && !name.startsWith("assets/minecraft/texts")) {
//TODO: tud this is broken fix it now please //TODO: tud this is broken fix it now please
@ -80,8 +79,8 @@ public class CustomClassLoader extends ClassLoader implements Util {
//TODO: double insecure tud please rewrite this //TODO: double insecure tud please rewrite this
//but remember it's also bloat i wanna keep it outside of the CustomClassLoader ok? //but remember it's also bloat i wanna keep it outside of the CustomClassLoader ok?
public class CustomMixinServer extends MixinServiceLaunchWrapper { public static class CustomMixinServer extends MixinServiceLaunchWrapper {
Map<String, byte[]> resources; final Map<String, byte[]> resources;
public CustomMixinServer(Map<String, byte[]> resources) { public CustomMixinServer(Map<String, byte[]> resources) {
this.resources = resources; this.resources = resources;

View file

@ -7,11 +7,11 @@ import java.util.Base64;
public class RSAKey implements Util { public class RSAKey implements Util {
PublicKey publicKey; final PublicKey publicKey;
PrivateKey privateKey; PrivateKey privateKey;
public RSAKey(String publicKey) throws Exception { public RSAKey(String publicKey) {
this.publicKey = decodeBase64ToPublicKey(publicKey); this.publicKey = decodeBase64ToPublicKey(publicKey);
} }
@ -30,7 +30,7 @@ public class RSAKey implements Util {
return keyPairGenerator.generateKeyPair(); return keyPairGenerator.generateKeyPair();
} catch (Exception e) { } catch (Exception e) {
LOGGER.fatal(e); LOGGER.fatal(e);
return null; throw new RuntimeException(e);
} }
} }
@ -41,7 +41,7 @@ public class RSAKey implements Util {
return Base64.getEncoder().encodeToString(cipher.doFinal(plainText.getBytes())); return Base64.getEncoder().encodeToString(cipher.doFinal(plainText.getBytes()));
} catch (Exception e) { } catch (Exception e) {
LOGGER.fatal(e); LOGGER.fatal(e);
return null; throw new RuntimeException(e);
} }
} }
@ -53,7 +53,7 @@ public class RSAKey implements Util {
return new String(decryptedBytes); return new String(decryptedBytes);
} catch (Exception e) { } catch (Exception e) {
LOGGER.fatal(e); LOGGER.fatal(e);
return null; throw new RuntimeException(e);
} }
} }
@ -65,7 +65,7 @@ public class RSAKey implements Util {
return keyFactory.generatePublic(keySpec); return keyFactory.generatePublic(keySpec);
} catch (Exception e) { } catch (Exception e) {
LOGGER.fatal(e); LOGGER.fatal(e);
return null; throw new RuntimeException(e);
} }
} }

View file

@ -22,8 +22,6 @@ public class Main {
Server webServiceServer = new Server(40001); Server webServiceServer = new Server(40001);
webServiceServer.addHandler(new WebServiceHandler()); webServiceServer.addHandler(new WebServiceHandler());
webServiceServer.run(); webServiceServer.run();
while(true);
} }

View file

@ -3,12 +3,10 @@ package dev.baseband.server;
import de.tudbut.net.ws.Connection; import de.tudbut.net.ws.Connection;
import de.tudbut.net.ws.ConnectionHandler; import de.tudbut.net.ws.ConnectionHandler;
import java.io.IOException;
public class WebServiceHandler implements ConnectionHandler { public class WebServiceHandler implements ConnectionHandler {
@Override @Override
public void run(Connection connection) throws IOException { public void run(Connection connection) {
} }
} }