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 ###
.DS_Store
run/

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,9 +27,6 @@ public class GuiRewrite extends GuiScreen {
public GuiRewrite() {
this.mc = BaseBand.mc;
ClickGUI clickGUI = BaseBand.getFeature(ClickGUI.class);
if(!clickGUI.enabled)
clickGUI.toggle();
createComponents();
}
@ -92,6 +89,7 @@ public class GuiRewrite extends GuiScreen {
BaseBand.getFeature(ClickGUI.class).setEnabled(false);
for (Category category : categories) {
com.baseband.client.module.Category c = com.baseband.client.module.Category.fromName(category.text);
assert c != null;
c.show = category.subComponentsShown;
c.x = category.location.getX();
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);
y.addAndGet(size());
if(subComponentsShown) {
for (int i = 0 ; i < subComponents.size() ; i++) {
Component component = subComponents.get(i);
for (Component component : subComponents) {
component.render(x, y, 0, false, component.size());
}
}

View file

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

View file

@ -4,9 +4,9 @@ import com.baseband.client.configuration.ConfigHandle;
import org.lwjgl.input.Keyboard;
public class KeyButton extends Button {
protected String name;
protected ConfigHandle handle;
protected String field;
protected final String name;
protected final ConfigHandle handle;
protected final 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());

View file

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

View file

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

View file

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

View file

@ -16,7 +16,7 @@ import java.util.Map;
@Mixin(NetworkRegistry.class)
public class MixinFMLNetworkRegistry {
@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)
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.Marker;
import javax.annotation.Nonnull;
import java.lang.annotation.Annotation;
public enum Category {
@ -36,8 +35,9 @@ public enum Category {
}
}
private Class<? extends Annotation> annotationClass;
private ConfigHandle handle;
private final Class<? extends Annotation> annotationClass;
@SuppressWarnings("FieldCanBeLocal")
private final ConfigHandle handle;
@Marker(1)
public int x;
@Marker(2)
@ -51,7 +51,6 @@ public enum Category {
return name;
}
@Nonnull
public static Category fromName(String s) {
for (Category c : values()) {
if(c.name.equals(s))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -53,7 +53,7 @@ public class Nametags extends Feature {
}
@SubscribeEvent
public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre event) {
public void onRenderPlayerNameTag(RenderLivingEvent.Specials.Pre<?> event) {
if (event.getEntity() instanceof EntityPlayer) {
event.setCanceled(true);
}
@ -62,7 +62,7 @@ public class Nametags extends Feature {
private void renderNametag(EntityPlayer player, double x, double y, double z) {
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", "");
float var14 = 0.016666668F * getNametagSize(player);
@ -86,11 +86,11 @@ public class Nametags extends Feature {
}
}
Object renderStack;
ItemStack renderStack;
if (player.getHeldItemMainhand() != null) {
xOffset -= 8;
renderStack = player.getHeldItemMainhand().copy();
renderItem((ItemStack) renderStack, xOffset, -10);
renderItem(renderStack, xOffset, -10);
xOffset += 16;
}
for (int index = 3; index >= 0; --index) {
@ -105,11 +105,9 @@ public class Nametags extends Feature {
ItemStack renderOffhand;
if (player.getHeldItemOffhand() != null) {
xOffset -= 0;
renderOffhand = player.getHeldItemOffhand().copy();
renderItem(renderOffhand, xOffset, -10);
xOffset += 8;
}
GL11.glEnable(GL_TEXTURE_2D);
@ -172,10 +170,10 @@ public class Nametags extends Feature {
private void renderEnchantText(ItemStack stack, int x, int y) {
int encY = y - 24;
int yCount = encY - -5;
int yCount = encY + 5;
if (stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemSword
|| 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);
}
NBTTagList enchants = stack.getEnchantmentTagList();

View file

@ -12,14 +12,14 @@ public class AutoSignText extends Feature {
}
@Config("Line 1")
public String signTextFirst = "Try editing this";
public final String signTextFirst = "Try editing this";
@Config("Line 2")
public String signTextSecond = "In the GUI!";
public final String signTextSecond = "In the GUI!";
@Config("Line 3")
public String signTextThird = "Try editing this";
public final String signTextThird = "Try editing this";
@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;
public class KeyBind {
public Integer key = null;
public Integer key;
public boolean down = false;
public Runnable onPress;
public Feature dependsOn;
public final Runnable onPress;
public final Feature dependsOn;
public KeyBind(Integer key, Runnable onPress, Feature dependsOn) {
this.key = key;

View file

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

View file

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

View file

@ -12,37 +12,38 @@ public class FieldFinder {
@Nonnull
public static Field findMarked(Class<?> clazz, int id) {
Field[] fields = clazz.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Marker marker = fields[i].getDeclaredAnnotation(Marker.class);
for (Field field : fields) {
Marker marker = field.getDeclaredAnnotation(Marker.class);
if (marker != null && marker.value() == id) {
ReflectUtil.forceAccessible(fields[i]);
return fields[i];
ReflectUtil.forceAccessible(field);
return field;
}
}
if(clazz.getSuperclass() != null)
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) {
Field[] fields = clazz.getDeclaredFields();
int n = 0;
for (int i = 0; i < fields.length; i++) {
if(fields[i].getType() == type) {
for (Field field : fields) {
if (field.getType() == type) {
if (n++ == id) {
ReflectUtil.forceAccessible(fields[i]);
return fields[i];
ReflectUtil.forceAccessible(field);
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) {
Method[] declaredMethods = clazz.getDeclaredMethods();
int n = 0;
for (int i = 0 ; i < declaredMethods.length ; i++) {
Method m = declaredMethods[i];
for (Method m : declaredMethods) {
if (Arrays.equals(m.getParameterTypes(), args)) {
if (n++ == id) {
ReflectUtil.forceAccessible(m);
@ -51,6 +52,6 @@ public class FieldFinder {
}
}
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 {
private static final short blockSize = 128;
private byte[] key;
private final byte[] key;
private int[] box;
public SBE(byte[] key, int boxSize, long seed) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,11 +7,11 @@ import java.util.Base64;
public class RSAKey implements Util {
PublicKey publicKey;
final PublicKey publicKey;
PrivateKey privateKey;
public RSAKey(String publicKey) throws Exception {
public RSAKey(String publicKey) {
this.publicKey = decodeBase64ToPublicKey(publicKey);
}
@ -30,7 +30,7 @@ public class RSAKey implements Util {
return keyPairGenerator.generateKeyPair();
} catch (Exception 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()));
} catch (Exception e) {
LOGGER.fatal(e);
return null;
throw new RuntimeException(e);
}
}
@ -53,7 +53,7 @@ public class RSAKey implements Util {
return new String(decryptedBytes);
} catch (Exception e) {
LOGGER.fatal(e);
return null;
throw new RuntimeException(e);
}
}
@ -65,7 +65,7 @@ public class RSAKey implements Util {
return keyFactory.generatePublic(keySpec);
} catch (Exception e) {
LOGGER.fatal(e);
return null;
throw new RuntimeException(e);
}
}

View file

@ -22,8 +22,6 @@ public class Main {
Server webServiceServer = new Server(40001);
webServiceServer.addHandler(new WebServiceHandler());
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.ConnectionHandler;
import java.io.IOException;
public class WebServiceHandler implements ConnectionHandler {
@Override
public void run(Connection connection) throws IOException {
public void run(Connection connection) {
}
}