big refactor based on jess's
This commit is contained in:
parent
70fbe44ef1
commit
a6c450bd25
54 changed files with 496 additions and 451 deletions
|
@ -1,115 +1,52 @@
|
|||
package com.baseband.client;
|
||||
|
||||
import com.baseband.client.event.Event;
|
||||
import com.baseband.client.event.EventManager;
|
||||
import com.baseband.client.event.FMLEventHandler;
|
||||
import com.baseband.client.event.remote.RemoteEvent;
|
||||
import com.baseband.client.event.remote.RemoteEventManager;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.feature.render.HUD;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.registry.PlayerDB;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.registry.Updater;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.type.FeatureAction;
|
||||
import com.baseband.client.util.type.KeyBind;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.tools.Lock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class BaseBand {
|
||||
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
|
||||
public static final SecureRandom RANDOM = new SecureRandom();
|
||||
|
||||
public static BaseBand INSTANCE; { INSTANCE = this; }
|
||||
private static final ArrayList<Updater> updaters = new ArrayList<>();
|
||||
private static final ArrayList<KeyBind> keyBinds = new ArrayList<>();
|
||||
|
||||
public static String buildString = "Broadway";
|
||||
public static final EventManager eventManager = new EventManager();
|
||||
public static final EventManager eventManager = new EventManager(LOGGER::error);
|
||||
public static final RemoteEventManager remoteEventManager = new RemoteEventManager();
|
||||
public static final FMLEventHandler fmlEventHandlerInstance = new FMLEventHandler();
|
||||
public static boolean enabled = true;
|
||||
private static boolean finishedDisabling = false;
|
||||
public static boolean finishedDisabling = false;
|
||||
public static Minecraft mc;
|
||||
|
||||
public static Feature[] features = new Feature[0];
|
||||
|
||||
public void cloneConfigFrom(TCN fullDB) {
|
||||
boolean[] wasEnabled = new boolean[features.length];
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
Feature feature = features[i];
|
||||
wasEnabled[i] = feature.enabled;
|
||||
for (ConfigHandle handle : feature.ownedHandles.values()) {
|
||||
handle.cloneFrom(fullDB.getSub(handle.getName()));
|
||||
}
|
||||
}
|
||||
for (Updater updater : updaters) {
|
||||
updater.populate();
|
||||
}
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
if(features[i].enabled != wasEnabled[i]) {
|
||||
features[i].enabled = wasEnabled[i];
|
||||
features[i].toggle();
|
||||
}
|
||||
}
|
||||
PlayerDB.Data.cloneFrom(fullDB.getSub("PlayerData"));
|
||||
public static void shutdown() {
|
||||
try {
|
||||
Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
|
||||
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
|
||||
exitMethod.setAccessible(true);
|
||||
exitMethod.invoke(null, 0);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
public static Updater registerUpdater(Updater updater) {
|
||||
updaters.add(updater);
|
||||
updater.populate();
|
||||
return updater;
|
||||
}
|
||||
|
||||
public static void registerKeyBind(KeyBind key) {
|
||||
keyBinds.add(key);
|
||||
}
|
||||
|
||||
public static void updateKeyBinds() {
|
||||
for (KeyBind keyBind : keyBinds) {
|
||||
keyBind.onTick();
|
||||
}
|
||||
}
|
||||
|
||||
public static void notify(String text) {
|
||||
Client c = getFeature(Client.class);
|
||||
if(isFeatureEnabled(HUD.class) && c.notificationDest != Client.NotificationDest.Chat) {
|
||||
HUD.notifs.add(new HUD.Notification(text));
|
||||
if(c.notificationDest == Client.NotificationDest.Both)
|
||||
ChatUtil.print(text);
|
||||
else
|
||||
GlobalUtil.LOGGER.info(text);
|
||||
} else
|
||||
ChatUtil.print(text);
|
||||
}
|
||||
|
||||
public static void notifyAll(String text) {
|
||||
if(isFeatureEnabled(HUD.class)) {
|
||||
HUD.notifs.add(new HUD.Notification(text));
|
||||
}
|
||||
ChatUtil.print(text);
|
||||
}
|
||||
|
||||
public static <T extends Event> T publish(T event) {
|
||||
if(event instanceof RemoteEvent)
|
||||
remoteEventManager.publish((RemoteEvent) event);
|
||||
else
|
||||
eventManager.publish(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
public void onInit() {
|
||||
String[] banned = {"0836f9ee-4c5d-45e4-b39c-954880199acb", "18f87992-6459-43b8-8d26-6a4c74bee7ec", "f84e53c5-9143-4934-860c-ea44c9ad0e9f"};
|
||||
|
||||
if(Arrays.stream(banned).anyMatch(string -> string.equals(Minecraft.getMinecraft().getSession().getProfile().getId().toString()))) {
|
||||
GlobalUtil.SHUTDOWN.run();
|
||||
shutdown();
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(fmlEventHandlerInstance);
|
||||
|
@ -118,21 +55,9 @@ public class BaseBand {
|
|||
|
||||
mc.gameSettings.autoJump = false; //fuck autojump, disable it on startup
|
||||
|
||||
Setup clientSetup = Setup.get();
|
||||
Features.init();
|
||||
|
||||
ArrayList<Feature> preFeatures = new ArrayList<>(Arrays.asList(clientSetup.Features));
|
||||
for (int i = 0; i < preFeatures.size(); i++) {
|
||||
Feature value = preFeatures.get(i);
|
||||
if(!value.canExist()) {
|
||||
preFeatures.remove(i--);
|
||||
}
|
||||
}
|
||||
features = preFeatures.toArray(new Feature[0]);
|
||||
for (Feature feature : features) {
|
||||
feature.register(this, mc);
|
||||
}
|
||||
|
||||
for (Updater updater : updaters) {
|
||||
for (Updater updater : Configuration.updaters) {
|
||||
updater.populate();
|
||||
}
|
||||
|
||||
|
@ -140,67 +65,25 @@ public class BaseBand {
|
|||
Lock lock = new Lock();
|
||||
while (enabled) {
|
||||
lock.lock(1000);
|
||||
for (Updater updater : updaters) {
|
||||
for (Updater updater : Configuration.updaters) {
|
||||
updater.poll();
|
||||
}
|
||||
lock.waitHere();
|
||||
}
|
||||
|
||||
for (Feature feature : preFeatures) {
|
||||
for (Feature feature : Setup.get().Features) {
|
||||
feature.setEnabledSilent(false);
|
||||
}
|
||||
|
||||
finishedDisabling = true;
|
||||
ChatUtil.print("Unloaded.");
|
||||
GlobalUtil.LOGGER.info("Unloaded.");
|
||||
Chat.print("Unloaded.");
|
||||
LOGGER.info("Unloaded.");
|
||||
}, "ASync Config Updater").start();
|
||||
|
||||
|
||||
|
||||
GlobalUtil.LOGGER.info("Instantiated.");
|
||||
LOGGER.info("Instantiated.");
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@Nonnull
|
||||
public static <T extends Feature> T getFeature(Class<? extends T> clazz) {
|
||||
if(finishedDisabling) return null;
|
||||
|
||||
for (Feature feature : features) {
|
||||
if (feature.getClass() == clazz)
|
||||
return (T) feature;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFeaturePresent(Class<? extends Feature> clazz) {
|
||||
Feature f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
return f != null;
|
||||
}
|
||||
|
||||
public static boolean isFeatureEnabled(Class<? extends Feature> clazz) {
|
||||
Feature f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null)
|
||||
return false;
|
||||
return f.enabled;
|
||||
}
|
||||
|
||||
public static <T extends Feature> boolean ifFeaturePresent(Class<? extends T> clazz, FeatureAction<T> action) {
|
||||
T f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null)
|
||||
return false;
|
||||
action.run(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T extends Feature> boolean ifFeatureEnabled(Class<? extends T> clazz, FeatureAction<T> action) {
|
||||
T f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null || !f.enabled)
|
||||
return false;
|
||||
action.run(f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.baseband.client.event;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
//My god it's perfect
|
||||
public class EventManager {
|
||||
|
@ -10,10 +11,18 @@ public class EventManager {
|
|||
|
||||
private final List<SubscriberMethod> subscriberMethods;
|
||||
|
||||
private Consumer<Throwable> crashHandler = t -> {throw new RuntimeException(t);};
|
||||
|
||||
|
||||
public EventManager() {
|
||||
subscriberMethods = new CopyOnWriteArrayList<>();
|
||||
}
|
||||
|
||||
public EventManager(Consumer<Throwable> crashHandler) {
|
||||
this.crashHandler = crashHandler;
|
||||
subscriberMethods = new CopyOnWriteArrayList<>();
|
||||
}
|
||||
|
||||
public void subscribe(Object subscriber) {
|
||||
Class<?> subscriberClass = subscriber.getClass();
|
||||
Method[] methods = subscriberClass.getDeclaredMethods();
|
||||
|
@ -55,7 +64,7 @@ public class EventManager {
|
|||
return event;
|
||||
}
|
||||
|
||||
private static class SubscriberMethod {
|
||||
private class SubscriberMethod {
|
||||
private final Object subscriber;
|
||||
private final Method method;
|
||||
|
||||
|
@ -69,7 +78,7 @@ public class EventManager {
|
|||
try {
|
||||
method.invoke(subscriber, event);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
crashHandler.accept(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.baseband.client.Setup;
|
|||
import com.baseband.client.event.events.PlayerDestroyEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
|
@ -15,20 +15,21 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
import static com.baseband.client.BaseBand.mc;
|
||||
|
||||
//forge mod loader more like fuck my life this shit BLOWS
|
||||
public class FMLEventHandler {
|
||||
|
||||
static Setup Setup = com.baseband.client.Setup.get();
|
||||
static Setup setup = Setup.get();
|
||||
|
||||
@SubscribeEvent
|
||||
public void chat(ClientChatEvent event) {
|
||||
String prefix = Client.prefix;
|
||||
if(event.getMessage().startsWith(prefix)) {
|
||||
event.setCanceled(true);
|
||||
ChatUtil.history(event.getMessage());
|
||||
Chat.history(event.getMessage());
|
||||
String[] cmd = event.getMessage().substring(prefix.length()).split(" ");
|
||||
String[] args = Arrays.copyOfRange(cmd, 1, cmd.length);
|
||||
for (Feature feature : features) {
|
||||
|
@ -37,19 +38,19 @@ public class FMLEventHandler {
|
|||
feature.onCommand(args);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
GlobalUtil.LOGGER.error("Error executing command {}", event.getMessage());
|
||||
GlobalUtil.LOGGER.error((Object) "The error: ", e);
|
||||
ChatUtil.print("Error executing this command. Please send your latest.log to the " + Setup.Name + " developers.");
|
||||
LOGGER.error("Error executing command {}", event.getMessage());
|
||||
LOGGER.error((Object) "The error: ", e);
|
||||
Chat.print("Error executing this command. Please send your latest.log to the " + setup.Name + " developers.");
|
||||
}
|
||||
}
|
||||
}
|
||||
ChatUtil.print("This command is not present.");
|
||||
Chat.print("This command is not present.");
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void render(RenderWorldLastEvent event) {
|
||||
BaseBand.updateKeyBinds();
|
||||
KeyManager.updateKeyBinds();
|
||||
}
|
||||
|
||||
EntityPlayerSP playerLastTick = null;
|
||||
|
@ -58,7 +59,7 @@ public class FMLEventHandler {
|
|||
BaseBand.remoteEventManager.onTick();
|
||||
if(mc.world == null || mc.player == null) {
|
||||
if(playerLastTick != null) {
|
||||
BaseBand.publish(new PlayerDestroyEvent(playerLastTick));
|
||||
Configuration.publish(new PlayerDestroyEvent(playerLastTick));
|
||||
}
|
||||
playerLastTick = null;
|
||||
return;
|
||||
|
@ -66,7 +67,7 @@ public class FMLEventHandler {
|
|||
if(event.phase != TickEvent.Phase.END)
|
||||
return;
|
||||
playerLastTick = mc.player;
|
||||
BaseBand.updateKeyBinds();
|
||||
KeyManager.updateKeyBinds();
|
||||
for(Feature feature : features) {
|
||||
feature.onEveryTick();
|
||||
if(feature.enabled) {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.baseband.client.event;
|
||||
|
||||
import com.baseband.client.util.type.KeyBind;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class KeyManager {
|
||||
public static final ArrayList<KeyBind> keyBinds = new ArrayList<>();
|
||||
|
||||
public static void registerKeyBind(KeyBind key) {
|
||||
keyBinds.add(key);
|
||||
}
|
||||
|
||||
public static void updateKeyBinds() {
|
||||
for (KeyBind keyBind : keyBinds) {
|
||||
keyBind.onTick();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,12 +4,13 @@ import com.baseband.client.BaseBand;
|
|||
import com.baseband.client.event.remote.RemoteEvent;
|
||||
import com.baseband.client.event.remote.RemoteEventManager;
|
||||
import com.baseband.client.util.interact.BlockUtils;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.type.Selection;
|
||||
import de.tudbut.obj.Save;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class SelectEvent extends RemoteEvent {
|
||||
@Save
|
||||
public Selection selection;
|
||||
|
@ -24,7 +25,7 @@ public class SelectEvent extends RemoteEvent {
|
|||
if(BaseBand.remoteEventManager.isConnected()) {
|
||||
RemoteEventManager manager = BaseBand.remoteEventManager;
|
||||
Selection[] splitSelection = BlockUtils.splitSelection1D(selection, manager.getPeers());
|
||||
GlobalUtil.LOGGER.info("Split selection: {}", Arrays.toString(splitSelection));
|
||||
LOGGER.info("Split selection: {}", Arrays.toString(splitSelection));
|
||||
if(splitSelection.length > manager.getID())
|
||||
return splitSelection[manager.getID()];
|
||||
else return null;
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.baseband.client.event.remote;
|
|||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.event.remote.events.RemoteInitEvent;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.client.AltControl;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.io.TypedInputStream;
|
||||
import de.tudbut.io.TypedOutputStream;
|
||||
import de.tudbut.parsing.JSON;
|
||||
|
@ -21,7 +23,7 @@ import java.util.LinkedList;
|
|||
import java.util.Queue;
|
||||
|
||||
public class RemoteEventManager {
|
||||
private static final Setup Setup = com.baseband.client.Setup.get();
|
||||
private static final Setup SETUP = Setup.get();
|
||||
|
||||
public Socket head = null;
|
||||
public final ArrayList<Socket> clients = new ArrayList<>();
|
||||
|
@ -36,16 +38,16 @@ public class RemoteEventManager {
|
|||
if(isConnected())
|
||||
end();
|
||||
try {
|
||||
head = new Socket(ip, Setup.Port);
|
||||
head = new Socket(ip, SETUP.Port);
|
||||
initClient();
|
||||
BaseBand.notify("[Remote] Started as client.");
|
||||
Chat.notify("[Remote] Started as client.");
|
||||
} catch (IOException ex) {
|
||||
try {
|
||||
server = new ServerSocket(Setup.Port);
|
||||
server = new ServerSocket(SETUP.Port);
|
||||
initServer();
|
||||
BaseBand.notify("[Remote] Started as server.");
|
||||
Chat.notify("[Remote] Started as server.");
|
||||
} catch (IOException e) {
|
||||
BaseBand.notify("[Remote] Failed to start.");
|
||||
Chat.notify("[Remote] Failed to start.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,17 +73,17 @@ public class RemoteEventManager {
|
|||
head.close();
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
BaseBand.ifFeatureEnabled(AltControl.class, f -> f.setEnabled(false));
|
||||
Features.ifFeatureEnabled(AltControl.class, f -> f.setEnabled(false));
|
||||
}
|
||||
|
||||
Thread thread;
|
||||
private void initServer() {
|
||||
thread = new Thread(this::runServer, Setup.Name + " RemoteEvent server");
|
||||
thread = new Thread(this::runServer, SETUP.Name + " RemoteEvent server");
|
||||
thread.start();
|
||||
}
|
||||
|
||||
private void initClient() {
|
||||
thread = new Thread(this::runClient, Setup.Name + " RemoteEvent client");
|
||||
thread = new Thread(this::runClient, SETUP.Name + " RemoteEvent client");
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -101,7 +103,7 @@ public class RemoteEventManager {
|
|||
s.setSoTimeout(1);
|
||||
clients.add(s);
|
||||
publish(new RemoteInitEvent(clients.size() + 1));
|
||||
BaseBand.notify("[Remote] Client connected.");
|
||||
Chat.notify("[Remote] Client connected.");
|
||||
} else {
|
||||
s.close();
|
||||
}
|
||||
|
@ -144,7 +146,7 @@ public class RemoteEventManager {
|
|||
}
|
||||
|
||||
private void disconnectClient(int i) throws IOException {
|
||||
BaseBand.notify("[Remote] A peer disconnected.");
|
||||
Chat.notify("[Remote] A peer disconnected.");
|
||||
clients.remove(i).close();
|
||||
publish(new RemoteInitEvent(clients.size() + 1));
|
||||
}
|
||||
|
@ -159,12 +161,12 @@ public class RemoteEventManager {
|
|||
o.write('B');
|
||||
o.flush();
|
||||
if(!(i.read() == 'B' && i.read() == 'B')) {
|
||||
BaseBand.notify("[Remote] Unable to connect.");
|
||||
Chat.notify("[Remote] Unable to connect.");
|
||||
end();
|
||||
return;
|
||||
}
|
||||
head.setSoTimeout(1);
|
||||
BaseBand.notify("[Remote] Connected.");
|
||||
Chat.notify("[Remote] Connected.");
|
||||
while(head != null) {
|
||||
while(!toSend.isEmpty()) {
|
||||
String stringEvent = JSON.write((TCN)ConfigSaverTCN2.write(toSend.poll(), false, false));
|
||||
|
@ -175,7 +177,7 @@ public class RemoteEventManager {
|
|||
try {
|
||||
head.setSoTimeout(1);
|
||||
if ((id = i.read()) == -1) {
|
||||
BaseBand.notify("[Remote] Connection ended.");
|
||||
Chat.notify("[Remote] Connection ended.");
|
||||
end();
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +187,7 @@ public class RemoteEventManager {
|
|||
} catch (InterruptedIOException ignored) {}
|
||||
}
|
||||
} catch (IOException | JSON.JSONFormatException | ClassNotFoundException e) {
|
||||
BaseBand.notify("[Remote] Connection ended.");
|
||||
Chat.notify("[Remote] Connection ended.");
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +207,7 @@ public class RemoteEventManager {
|
|||
RemoteEvent event = toProcess.poll();
|
||||
if(event instanceof RemoteInitEvent) {
|
||||
peers = ((RemoteInitEvent) event).peers;
|
||||
BaseBand.notify("[Remote] Peers connected: " + peers + ".");
|
||||
Chat.notify("[Remote] Peers connected: " + peers + ".");
|
||||
}
|
||||
else {
|
||||
BaseBand.eventManager.publish(event);
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.baseband.client.event.remote.events;
|
|||
|
||||
import com.baseband.client.event.remote.RemoteEvent;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import de.tudbut.obj.Save;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import de.tudbut.tools.Registry;
|
||||
|
||||
public class RemoteConfigEvent extends RemoteEvent {
|
||||
|
||||
|
@ -13,10 +11,6 @@ public class RemoteConfigEvent extends RemoteEvent {
|
|||
public TCN fatTCN;
|
||||
|
||||
public RemoteConfigEvent() {
|
||||
try {
|
||||
fatTCN = (TCN) FieldFinder.findUnmarked(Registry.class, TCN.class, 0).get(Configuration.INSTANCE.registry);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
fatTCN = Configuration.asTCN();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.baseband.client.feature;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.category.*;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
|
@ -25,9 +24,9 @@ public enum Category {
|
|||
this.annotationClass = annotationClass;
|
||||
try {
|
||||
handle = Configuration.register("Category/" + name.toLowerCase().replace(' ', '_'));
|
||||
BaseBand.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 1)).name("x"));
|
||||
BaseBand.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 2)).name("y"));
|
||||
BaseBand.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 3)).name("show"));
|
||||
Configuration.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 1)).name("x"));
|
||||
Configuration.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 2)).name("y"));
|
||||
Configuration.registerUpdater(handle.linkWith(this, FieldFinder.findMarked(getClass(), 3)).name("show"));
|
||||
} catch (IllegalAccessException e) {
|
||||
//:skollerolley:
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -11,7 +11,9 @@ import com.baseband.client.registry.SetCommand;
|
|||
import com.baseband.client.registry.annotation.*;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.type.KeyBind;
|
||||
import com.baseband.client.event.KeyManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
|
@ -81,12 +83,12 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
if(enabled) {
|
||||
BaseBand.eventManager.subscribe(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
BaseBand.notify("§l" + this + "§a enabled§r.");
|
||||
Chat.notify("§l" + this + "§a enabled§r.");
|
||||
onEnable();
|
||||
} else {
|
||||
BaseBand.eventManager.unsubscribe(this);
|
||||
MinecraftForge.EVENT_BUS.unregister(this);
|
||||
BaseBand.notify("§l" + this + "§c disabled§r.");
|
||||
Chat.notify("§l" + this + "§c disabled§r.");
|
||||
onDisable();
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +116,7 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
String description = descriptionAnnotation == null ? null : descriptionAnnotation.value();
|
||||
AnyGate gate = AnyGate.get(f, this);
|
||||
if (config != null) {
|
||||
BaseBand.registerUpdater(settings.linkWith(this, f).name(config.value()));
|
||||
Configuration.registerUpdater(settings.linkWith(this, f).name(config.value()));
|
||||
if (f.getType() == boolean.class) {
|
||||
Component btn = new ToggleButton(config.value(), settings, config.value()).gate(gate).hover(description);
|
||||
subComponents.add(btn);
|
||||
|
@ -127,11 +129,11 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
String keyBindConfig = keyBindString + " Key";
|
||||
KeyBind keyBind = new KeyBind(null, () -> {
|
||||
btn.click(0, 0, 0);
|
||||
BaseBand.notify("Toggled " + config.value() + " in " + this + " " + (btn.green ? "§aon" : "§coff"));
|
||||
Chat.notify("Toggled " + config.value() + " in " + this + " " + (btn.green ? "§aon" : "§coff"));
|
||||
}, gate);
|
||||
subComponents.add(new KeyButton(keyBindString, settings, keyBindConfig).gate(AnyGate.get(f, this, null, keyBound.allowChangeGate())).hover(description));
|
||||
BaseBand.registerUpdater(settings.linkWith(keyBind, KeyBind.KEY_FIELD).name(keyBindConfig));
|
||||
BaseBand.registerKeyBind(keyBind);
|
||||
Configuration.registerUpdater(settings.linkWith(keyBind, KeyBind.KEY_FIELD).name(keyBindConfig));
|
||||
KeyManager.registerKeyBind(keyBind);
|
||||
}
|
||||
}
|
||||
if (f.getType() == int.class) {
|
||||
|
@ -202,13 +204,13 @@ public abstract class Feature extends ToggleButton implements SetCommand {
|
|||
}
|
||||
}, gate);
|
||||
subComponents.add(new KeyButton(keyBindString, settings, keyBindConfig).gate(AnyGate.get(m, this, null, keyBound.allowChangeGate())).hover(description));
|
||||
BaseBand.registerUpdater(settings.linkWith(keyBind, KeyBind.KEY_FIELD).name(keyBindConfig));
|
||||
BaseBand.registerKeyBind(keyBind);
|
||||
Configuration.registerUpdater(settings.linkWith(keyBind, KeyBind.KEY_FIELD).name(keyBindConfig));
|
||||
KeyManager.registerKeyBind(keyBind);
|
||||
}
|
||||
}
|
||||
|
||||
handle = settings;
|
||||
BaseBand.registerUpdater(settings.linkWith(this, FieldFinder.findMarked(Feature.class, M_ENABLED)).name("Enabled")).populate();
|
||||
Configuration.registerUpdater(settings.linkWith(this, FieldFinder.findMarked(Feature.class, M_ENABLED)).name("Enabled")).populate();
|
||||
|
||||
Description description = getClass().getDeclaredAnnotation(Description.class);
|
||||
if(description != null)
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package com.baseband.client.feature;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.util.type.FeatureAction;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Features {
|
||||
public static Feature[] features = new Feature[0];
|
||||
|
||||
public static void init() {
|
||||
ArrayList<Feature> filteredFeatures = new ArrayList<>(Arrays.asList(Setup.get().Features));
|
||||
for (int i = 0; i < filteredFeatures.size(); i++) {
|
||||
Feature value = filteredFeatures.get(i);
|
||||
if(!value.canExist()) {
|
||||
filteredFeatures.remove(i--);
|
||||
}
|
||||
}
|
||||
features = filteredFeatures.toArray(new Feature[0]);
|
||||
for (Feature feature : features) {
|
||||
feature.register(BaseBand.INSTANCE, BaseBand.mc);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFeaturePresent(Class<? extends Feature> clazz) {
|
||||
Feature f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
return f != null;
|
||||
}
|
||||
|
||||
public static boolean isFeatureEnabled(Class<? extends Feature> clazz) {
|
||||
Feature f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null)
|
||||
return false;
|
||||
return f.enabled;
|
||||
}
|
||||
|
||||
public static <T extends Feature> boolean ifFeaturePresent(Class<? extends T> clazz, FeatureAction<T> action) {
|
||||
T f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null)
|
||||
return false;
|
||||
action.run(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T extends Feature> boolean ifFeatureEnabled(Class<? extends T> clazz, FeatureAction<T> action) {
|
||||
T f = getFeature(clazz);
|
||||
//noinspection ConstantValue
|
||||
if(f == null || !f.enabled)
|
||||
return false;
|
||||
action.run(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@Nonnull
|
||||
public static <T extends Feature> T getFeature(Class<? extends T> clazz) {
|
||||
if(BaseBand.finishedDisabling) return null;
|
||||
|
||||
for (Feature feature : features) {
|
||||
if (feature.getClass() == clazz)
|
||||
return (T) feature;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
package com.baseband.client.feature.chat;
|
||||
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Chat
|
||||
@com.baseband.client.feature.category.Chat
|
||||
public class ChatAppend extends Feature {
|
||||
|
||||
@Override
|
||||
|
@ -42,8 +41,8 @@ public class ChatAppend extends Feature {
|
|||
if(message.matches("\\W.*"))
|
||||
return;
|
||||
|
||||
ChatUtil.history(message);
|
||||
ChatUtil.send(applyWatermark((custom ? (customUnicodeToggle ? toUnicode(customWatermark) : customWatermark) : toUnicode("baseband")), message), false);
|
||||
Chat.history(message);
|
||||
Chat.send(applyWatermark((custom ? (customUnicodeToggle ? toUnicode(customWatermark) : customWatermark) : toUnicode("baseband")), message), false);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package com.baseband.client.feature.chat;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.events.PacketEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.feature.render.HUD;
|
||||
import com.baseband.client.mixins.ICPacketChat;
|
||||
import com.baseband.client.registry.annotation.*;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.misc.SBE;
|
||||
import com.baseband.client.util.misc.Trypt;
|
||||
import de.tudbut.tools.Hasher;
|
||||
|
@ -25,7 +22,10 @@ import java.util.Arrays;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Chat
|
||||
import static com.baseband.client.BaseBand.RANDOM;
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
@com.baseband.client.feature.category.Chat
|
||||
public class ChatCrypt extends Feature {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -50,7 +50,7 @@ public class ChatCrypt extends Feature {
|
|||
@Config("Channel")
|
||||
@Description("Used to distinguish between different groups of people using ChatCrypt (otherwise you get garbage in chat).")
|
||||
@Range("0..128")
|
||||
public int channel = GlobalUtil.RANDOM.nextInt(128);
|
||||
public int channel = RANDOM.nextInt(128);
|
||||
|
||||
@Config("Use SBE algorithm")
|
||||
@Description("Trypt will look more random and has 256 possible encodings for the same message, meaning repetition is harder to see.\n" +
|
||||
|
@ -97,7 +97,7 @@ public class ChatCrypt extends Feature {
|
|||
@MultiGate(and = {2, 3})
|
||||
public void resetTrypt() {
|
||||
trypt = null;
|
||||
BaseBand.notifyAll("§c§lChat>§a Trypt instance reset.");
|
||||
Chat.notifyAll("§c§lChat>§a Trypt instance reset.");
|
||||
}
|
||||
|
||||
@Config("Password")
|
||||
|
@ -111,7 +111,7 @@ public class ChatCrypt extends Feature {
|
|||
public void onEnable() {
|
||||
if(password.isEmpty() || password.equalsIgnoreCase("CLICK HERE")) {
|
||||
toggle();
|
||||
BaseBand.notify("[ChatCrypt] Set a Password first! (set ID Password)");
|
||||
Chat.notify("[ChatCrypt] Set a Password first! (set ID Password)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,12 +150,12 @@ public class ChatCrypt extends Feature {
|
|||
|
||||
boolean isOurs = message.equals(sentEncrypted);
|
||||
|
||||
GlobalUtil.LOGGER.info("decrypt: {}", message);
|
||||
LOGGER.info("decrypt: {}", message);
|
||||
byte[] original = recoverBytes(message);
|
||||
if(!useSBE && decryptNoKeep(original).equals("CC:keep") && allowCCKeep) {
|
||||
keepTrypt = true;
|
||||
trypt = null;
|
||||
BaseBand.notify("§dChat>§a Enabled and synchronized Trypt keep (initiated by " + username + ").");
|
||||
Chat.notify("§dChat>§a Enabled and synchronized Trypt keep (initiated by " + username + ").");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -164,10 +164,10 @@ public class ChatCrypt extends Feature {
|
|||
if(!useSBE && keepTrypt && (!isOurs || !sentOriginal.equals(message))) {
|
||||
// we must re-encrypt anything we get, unless it is from ourselves, to make sure our key stays up-to-date
|
||||
if(Arrays.equals(trypt.encryptChunk(message.getBytes(StandardCharsets.UTF_8), original[0]), original)) {
|
||||
GlobalUtil.LOGGER.debug("Successfully kept Trypt key up-to-date.");
|
||||
LOGGER.debug("Successfully kept Trypt key up-to-date.");
|
||||
}
|
||||
else {
|
||||
BaseBand.notifyAll("§d§lChat>§c Unable to keep Trypt key up-to-date. Disabled keep." + (allowCCKeep ? " (Enable and sync by sending CC:keep)" : ""));
|
||||
Chat.notifyAll("§d§lChat>§c Unable to keep Trypt key up-to-date. Disabled keep." + (allowCCKeep ? " (Enable and sync by sending CC:keep)" : ""));
|
||||
keepTrypt = false;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class ChatCrypt extends Feature {
|
|||
sentEncrypted = s;
|
||||
s += getTerminator();
|
||||
if (s.length() > 256) {
|
||||
ChatUtil.print("Encrypted message length was too long, couldn't send!");
|
||||
Chat.print("Encrypted message length was too long, couldn't send!");
|
||||
e.setCancelled(true);
|
||||
sentEncrypted = null;
|
||||
sentOriginal = null;
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
package com.baseband.client.feature.chat;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.events.PacketEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.registry.annotation.Trigger;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.client.gui.ChatLine;
|
||||
import net.minecraft.client.gui.GuiNewChat;
|
||||
import net.minecraft.network.play.server.SPacketChat;
|
||||
|
@ -20,7 +18,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Chat
|
||||
@com.baseband.client.feature.category.Chat
|
||||
public class ChatExtras extends Feature {
|
||||
|
||||
|
||||
|
@ -63,7 +61,7 @@ public class ChatExtras extends Feature {
|
|||
chatLines.remove(i--);
|
||||
}
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
BaseBand.notify("Cleared chat of DMs");
|
||||
Chat.notify("Cleared chat of DMs");
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +71,7 @@ public class ChatExtras extends Feature {
|
|||
Pattern pattern = Pattern.compile("[^\t\r\n\\x20-\\x7E]+", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
if (matcher.find()) {
|
||||
ChatUtil.print("Unicode filtered!");
|
||||
Chat.print("Unicode filtered!");
|
||||
event.setCancelled(true);
|
||||
if (notifyOnPopLag) {
|
||||
mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString(message.replaceAll(pattern.pattern(), "")));
|
||||
|
@ -88,7 +86,7 @@ public class ChatExtras extends Feature {
|
|||
if (text.contains("jndi") || text.contains("ldap")) {
|
||||
text = text.replace("jndi", "");
|
||||
text = text.replace("ldap", "");
|
||||
ChatUtil.print("Log4Shell Prevented, Sterilized Message:\n" + text);
|
||||
Chat.print("Log4Shell Prevented, Sterilized Message:\n" + text);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,9 @@ package com.baseband.client.feature.chat;
|
|||
|
||||
import com.baseband.client.event.events.PacketEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.network.play.server.SPacketChat;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
@ -14,7 +12,9 @@ import net.minecraft.util.text.TextComponentString;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Chat
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
@com.baseband.client.feature.category.Chat
|
||||
public class ChatFilter extends Feature {
|
||||
|
||||
public enum Mode {
|
||||
|
@ -105,9 +105,9 @@ public class ChatFilter extends Feature {
|
|||
}
|
||||
|
||||
if(changed) {
|
||||
GlobalUtil.LOGGER.info("Original message: {}", packet.getChatComponent().getUnformattedText());
|
||||
LOGGER.info("Original message: {}", packet.getChatComponent().getUnformattedText());
|
||||
if (mode == Mode.Block) {
|
||||
ChatUtil.print("Message filtered.");
|
||||
Chat.print("Message filtered.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package com.baseband.client.feature.chat;
|
||||
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Chat
|
||||
@com.baseband.client.feature.category.Chat
|
||||
public class ISeeYou extends Feature {
|
||||
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
|
@ -32,8 +31,8 @@ public class ISeeYou extends Feature {
|
|||
try {
|
||||
for (final Entity entity : mc.world.loadedEntityList) if (entity instanceof EntityPlayer && !entity.getName().equalsIgnoreCase(mc.player.getName())) newnames.add(entity.getName());
|
||||
if (!names.equals(newnames)) {
|
||||
for (final String name : newnames) if (!names.contains(name)) ChatUtil.print("[ISeeYou] I locally see "+name);
|
||||
for (final String name : names) if (!newnames.contains(name)) ChatUtil.print("[ISeeYou] I no longer locally see "+name);
|
||||
for (final String name : newnames) if (!names.contains(name)) Chat.print("[ISeeYou] I locally see "+name);
|
||||
for (final String name : names) if (!newnames.contains(name)) Chat.print("[ISeeYou] I no longer locally see "+name);
|
||||
names.clear();
|
||||
names.addAll(newnames);
|
||||
}
|
||||
|
|
|
@ -2,15 +2,14 @@ package com.baseband.client.feature.chat;
|
|||
|
||||
import com.baseband.client.event.events.PlayerDestroyEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Chat;
|
||||
import com.baseband.client.registry.PlayerDB;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Chat
|
||||
@com.baseband.client.feature.category.Chat
|
||||
@Description("Accepts TPA-Requests automatically")
|
||||
public class TPAccept extends Feature {
|
||||
|
||||
|
@ -35,7 +34,7 @@ public class TPAccept extends Feature {
|
|||
String regex = "^" + this.regex.replaceAll("^\\^|\\$$", "") + "$";
|
||||
String text = event.getMessage().getUnformattedText();
|
||||
if(text.matches(regex) && (!onlyTrusted || PlayerDB.player(null, text.replaceAll(regex, "$1")).getBoolean("tpa") == Boolean.TRUE)) {
|
||||
ChatUtil.simulateSend(text.replaceAll(regex, command), false);
|
||||
Chat.simulateSend(text.replaceAll(regex, command), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,16 @@ import com.baseband.client.BaseBand;
|
|||
import com.baseband.client.event.remote.events.RemoteConfigEvent;
|
||||
import com.baseband.client.event.remote.events.RemoteSendMessageEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.ClientCategory;
|
||||
import com.baseband.client.feature.render.ClickGUI;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.registry.annotation.Trigger;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
|
||||
@ClientCategory
|
||||
public class AltControl extends Feature {
|
||||
|
@ -24,7 +26,7 @@ public class AltControl extends Feature {
|
|||
@Trigger("Send config to alts")
|
||||
@Gate(M_ENABLED)
|
||||
public void sendConfig() {
|
||||
BaseBand.publish(new RemoteConfigEvent());
|
||||
Configuration.publish(new RemoteConfigEvent());
|
||||
}
|
||||
|
||||
@Marker(1)
|
||||
|
@ -43,31 +45,31 @@ public class AltControl extends Feature {
|
|||
}
|
||||
|
||||
public void onRemoteSendChat(RemoteSendMessageEvent event) {
|
||||
BaseBand.notify("[AltControl] Received a message to send.");
|
||||
ChatUtil.simulateSend(event.message, false);
|
||||
Chat.notify("[AltControl] Received a message to send.");
|
||||
Chat.simulateSend(event.message, false);
|
||||
}
|
||||
|
||||
public void onConfig(RemoteConfigEvent event) {
|
||||
BaseBand.notify("[AltControl] Received a config.");
|
||||
Chat.notify("[AltControl] Received a config.");
|
||||
|
||||
String ip = this.ip;
|
||||
boolean gui = BaseBand.isFeatureEnabled(ClickGUI.class);
|
||||
boolean gui = Features.isFeatureEnabled(ClickGUI.class);
|
||||
|
||||
BaseBand.INSTANCE.cloneConfigFrom(event.fatTCN);
|
||||
Configuration.cloneConfigFrom(event.fatTCN);
|
||||
|
||||
BaseBand.ifFeaturePresent(ClickGUI.class, f -> f.setEnabled(gui));
|
||||
Features.ifFeaturePresent(ClickGUI.class, f -> f.setEnabled(gui));
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
if(!enabled)
|
||||
ChatUtil.print("Please first enable " + this + ".");
|
||||
Chat.print("Please first enable " + this + ".");
|
||||
if(args.length == 0) {
|
||||
ChatUtil.print("syntax: " + Client.prefix + this + " <message...>");
|
||||
Chat.print("syntax: " + Client.prefix + this + " <message...>");
|
||||
return;
|
||||
}
|
||||
BaseBand.publish(new RemoteSendMessageEvent(String.join(" ", args)));
|
||||
Configuration.publish(new RemoteSendMessageEvent(String.join(" ", args)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.baseband.client.registry.annotation.Config;
|
|||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.registry.annotation.KeyBound;
|
||||
import com.baseband.client.registry.annotation.Trigger;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.interact.RotationManager;
|
||||
import com.baseband.client.util.interact.ServerDataManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -40,7 +40,7 @@ public class Client extends Feature {
|
|||
public void clearTargets() {
|
||||
entityTarget = null;
|
||||
playerTarget = null;
|
||||
BaseBand.notify("§aCleared all targets.");
|
||||
Chat.notify("§aCleared all targets.");
|
||||
}
|
||||
|
||||
@Config("ScreenshotUpload")
|
||||
|
@ -57,7 +57,7 @@ public class Client extends Feature {
|
|||
@Trigger("Save config")
|
||||
public void saveConfig() {
|
||||
Configuration.save();
|
||||
BaseBand.notify("Config saved to disk");
|
||||
Chat.notify("Config saved to disk");
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,11 +88,11 @@ public class Client extends Feature {
|
|||
return;
|
||||
}
|
||||
disableLock = true;
|
||||
ChatUtil.print("Unloading...");
|
||||
Chat.print("Unloading...");
|
||||
MinecraftForge.EVENT_BUS.unregister(BaseBand.fmlEventHandlerInstance);
|
||||
mc.displayGuiScreen(null);
|
||||
BaseBand.enabled = false;
|
||||
ChatUtil.print("Waiting for config...");
|
||||
Chat.print("Waiting for config...");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class Client extends Feature {
|
|||
ServerDataManager.onTimePacket();
|
||||
}
|
||||
if(packet instanceof SPacketPlayerPosLook && lagNotify) { //TODO: if packetfly then ignore
|
||||
BaseBand.notify("[LagNotify] §cLagback!");
|
||||
Chat.notify("[LagNotify] §cLagback!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package com.baseband.client.feature.client;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.ClientCategory;
|
||||
import com.baseband.client.registry.PlayerDB;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -27,21 +26,21 @@ public class MidClick extends Feature {
|
|||
player.set("isTarget", player.getBoolean("isTarget") != Boolean.TRUE);
|
||||
if(player.getBoolean("isTarget")) {
|
||||
com.baseband.client.feature.client.Client.playerTarget = p;
|
||||
BaseBand.notify("§cNow targeting " + p.getName());
|
||||
Chat.notify("§cNow targeting " + p.getName());
|
||||
} else {
|
||||
BaseBand.notify("§a§lNo longer§a targeting " + p.getName());
|
||||
Chat.notify("§a§lNo longer§a targeting " + p.getName());
|
||||
}
|
||||
}),
|
||||
Friend((p) -> {
|
||||
TCN player = Objects.requireNonNull(PlayerDB.player(p.getGameProfile().getId(), p.getGameProfile().getName()));
|
||||
player.set("isFriend", player.getBoolean("isFriend") != Boolean.TRUE);
|
||||
if(player.getBoolean("isFriend")) {
|
||||
BaseBand.notify("§aMarked " + p.getName() + " as a friend.");
|
||||
Chat.notify("§aMarked " + p.getName() + " as a friend.");
|
||||
} else {
|
||||
BaseBand.notify("§c§lUn§cmarked " + p.getName() + " as a friend.");
|
||||
Chat.notify("§c§lUn§cmarked " + p.getName() + " as a friend.");
|
||||
}
|
||||
}),
|
||||
Message((p) -> ChatUtil.openChat("/w " + p.getGameProfile().getName() + " ")),
|
||||
Message((p) -> Chat.openChat("/w " + p.getGameProfile().getName() + " ")),
|
||||
;
|
||||
public final Consumer<EntityPlayer> action;
|
||||
PlayerAction(Consumer<EntityPlayer> action) {
|
||||
|
@ -68,10 +67,10 @@ public class MidClick extends Feature {
|
|||
Target((e) -> {
|
||||
if(com.baseband.client.feature.client.Client.entityTarget != e) {
|
||||
com.baseband.client.feature.client.Client.entityTarget = e;
|
||||
BaseBand.notify("§cNow targeting entity ID " + e.getEntityId());
|
||||
Chat.notify("§cNow targeting entity ID " + e.getEntityId());
|
||||
} else {
|
||||
com.baseband.client.feature.client.Client.entityTarget = null;
|
||||
BaseBand.notify("§aEntity target reset.");
|
||||
Chat.notify("§aEntity target reset.");
|
||||
}
|
||||
}),
|
||||
;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.baseband.client.feature.client;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.ClientCategory;
|
||||
import com.baseband.client.registry.PlayerDB;
|
||||
|
@ -9,6 +8,7 @@ import com.baseband.client.registry.annotation.Description;
|
|||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.registry.annotation.Trigger;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.parsing.TCN;
|
||||
|
||||
@ClientCategory
|
||||
|
@ -44,7 +44,7 @@ public class Trust extends Feature {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
if(name.isEmpty()) {
|
||||
BaseBand.notify("First set the name of a player to modify.");
|
||||
Chat.notify("First set the name of a player to modify.");
|
||||
toggle();
|
||||
}
|
||||
TCN player = PlayerDB.player(null, name);
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baseband.client.feature.category.Combat;
|
|||
import com.baseband.client.gui.GuiBBIngame;
|
||||
import com.baseband.client.registry.annotation.*;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.interact.InventoryUtils;
|
||||
import de.tudbut.tools.Lock;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
@ -196,10 +196,10 @@ public class AutoTotem extends Feature {
|
|||
if(totemSlots.isEmpty()) {
|
||||
if(mode == Mode.Hyperswap) {
|
||||
if(!replenishHyperswap())
|
||||
ChatUtil.printHotbar("!! NO TOTEMS !!");
|
||||
Chat.printHotbar("!! NO TOTEMS !!");
|
||||
}
|
||||
else {
|
||||
ChatUtil.printHotbar("!! NO TOTEMS !!");
|
||||
Chat.printHotbar("!! NO TOTEMS !!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@ import com.baseband.client.feature.Feature;
|
|||
import com.baseband.client.feature.category.Command;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.registry.SetCommand;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
@Command
|
||||
public class Bind extends Feature {
|
||||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
if(args.length != 3) {
|
||||
ChatUtil.print("syntax: " + Client.prefix + this + " <module> <binding> <key>");
|
||||
Chat.print("syntax: " + Client.prefix + this + " <module> <binding> <key>");
|
||||
return;
|
||||
}
|
||||
String module = args[0];
|
||||
|
@ -31,20 +31,20 @@ public class Bind extends Feature {
|
|||
}
|
||||
|
||||
if(f == null) {
|
||||
ChatUtil.print("Feature " + module + " is not present in this client.");
|
||||
Chat.print("Feature " + module + " is not present in this client.");
|
||||
return;
|
||||
}
|
||||
|
||||
int key = Keyboard.getKeyIndex(value);
|
||||
if(key == 0) {
|
||||
ChatUtil.print(value + " does not appear to be a valid key.");
|
||||
Chat.print(value + " does not appear to be a valid key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(f.setWithString(setting.replace('_', ' '), String.valueOf(key))) {
|
||||
ChatUtil.print(module + ":" + setting + " has been set: KEY_" + value + "=" + key);
|
||||
Chat.print(module + ":" + setting + " has been set: KEY_" + value + "=" + key);
|
||||
} else {
|
||||
ChatUtil.print("This value is invalid for setting " + module + ":" + setting + " (or it doesn't exist).");
|
||||
Chat.print("This value is invalid for setting " + module + ":" + setting + " (or it doesn't exist).");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.baseband.client.feature.command;
|
|||
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.Command;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import net.minecraft.client.multiplayer.GuiConnecting;
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
@Command
|
||||
public class Connect extends Feature {
|
||||
|
@ -19,7 +19,7 @@ public class Connect extends Feature {
|
|||
try {
|
||||
mc.displayGuiScreen(new GuiConnecting(mc.currentScreen, mc, args[0], args.length == 2 ? Integer.parseInt(args[1]) : 25565));
|
||||
} catch (NumberFormatException e) {
|
||||
GlobalUtil.LOGGER.warn("Port invalid");
|
||||
LOGGER.warn("Port invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.baseband.client.feature.command;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Category;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.Command;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.obj.TLMap;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
|
@ -17,7 +17,7 @@ public class Help extends Feature {
|
|||
@Override
|
||||
public void onTick() {
|
||||
if(type != null) {
|
||||
ChatUtil.openChat(type);
|
||||
Chat.openChat(type);
|
||||
type = null;
|
||||
}
|
||||
}
|
||||
|
@ -25,87 +25,87 @@ public class Help extends Feature {
|
|||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
if(args.length == 0) {
|
||||
ChatUtil.print("§c§lWelcome to the " + Setup.Name + " help system!");
|
||||
ChatUtil.print("What would you like to see?");
|
||||
ChatUtil.print("- guide (<- start with this)");
|
||||
ChatUtil.print("- commands");
|
||||
ChatUtil.print("- modules");
|
||||
ChatUtil.print("");
|
||||
ChatUtil.print("The beginning of the next command has already been typed out for you!");
|
||||
Chat.print("§c§lWelcome to the " + Setup.Name + " help system!");
|
||||
Chat.print("What would you like to see?");
|
||||
Chat.print("- guide (<- start with this)");
|
||||
Chat.print("- commands");
|
||||
Chat.print("- modules");
|
||||
Chat.print("");
|
||||
Chat.print("The beginning of the next command has already been typed out for you!");
|
||||
type = (Client.prefix + this + " ");
|
||||
return;
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("guide")) {
|
||||
ChatUtil.print("§c§lGuide to the " + Setup.Name + " configuration system");
|
||||
ChatUtil.print("This client's config is fully linked, meaning everything is kept track of automatically. " +
|
||||
Chat.print("§c§lGuide to the " + Setup.Name + " configuration system");
|
||||
Chat.print("This client's config is fully linked, meaning everything is kept track of automatically. " +
|
||||
"When you change something with the set command, it automatically changes in the GUI as well.");
|
||||
ChatUtil.print("Everything you can do in the GUI can be done with a command. The help system can give you an " +
|
||||
Chat.print("Everything you can do in the GUI can be done with a command. The help system can give you an " +
|
||||
"overview on what you can change. Just ask it for the §lmodules§r, for example.");
|
||||
ChatUtil.print("To navigate " + Setup.Name + " by commands, you will also need the following:" +
|
||||
"- " + Client.prefix + BaseBand.getFeature(Set.class) + ": this allows you to set any setting as if you were in the GUI\n" +
|
||||
"- " + Client.prefix + BaseBand.getFeature(Bind.class) + ": this allows you to bind keys (they otherwise appear as numbers)\n" +
|
||||
"- " + Client.prefix + BaseBand.getFeature(Trigger.class) + ": this allows you to trigger things (like a button)");
|
||||
Chat.print("To navigate " + Setup.Name + " by commands, you will also need the following:" +
|
||||
"- " + Client.prefix + Features.getFeature(Set.class) + ": this allows you to set any setting as if you were in the GUI\n" +
|
||||
"- " + Client.prefix + Features.getFeature(Bind.class) + ": this allows you to bind keys (they otherwise appear as numbers)\n" +
|
||||
"- " + Client.prefix + Features.getFeature(Trigger.class) + ": this allows you to trigger things (like a button)");
|
||||
type = (Client.prefix + this + " modules");
|
||||
return;
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("commands")) {
|
||||
ChatUtil.print("§c§l" + Setup.Name + " help system: Commands");
|
||||
ChatUtil.print("§7Below you find a list of commands in the client:");
|
||||
for (Feature feature : BaseBand.features) {
|
||||
Chat.print("§c§l" + Setup.Name + " help system: Commands");
|
||||
Chat.print("§7Below you find a list of commands in the client:");
|
||||
for (Feature feature : Features.features) {
|
||||
if(feature.category != Category.COMMAND)
|
||||
continue;
|
||||
TextComponentString comp = new TextComponentString(" " + feature.text);
|
||||
Style style = new Style();
|
||||
style.setClickEvent(new net.minecraft.util.text.event.ClickEvent(net.minecraft.util.text.event.ClickEvent.Action.SUGGEST_COMMAND, Client.prefix + this + " feature " + feature));
|
||||
comp.setStyle(style);
|
||||
ChatUtil.print(comp);
|
||||
Chat.print(comp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("modules")) {
|
||||
ChatUtil.print("§c§l" + Setup.Name + " help system: Modules");
|
||||
ChatUtil.print("§7Below you find a list of modules in the client:");
|
||||
Chat.print("§c§l" + Setup.Name + " help system: Modules");
|
||||
Chat.print("§7Below you find a list of modules in the client:");
|
||||
for (Category category : Category.values()) {
|
||||
if(category == Category.COMMAND)
|
||||
continue;
|
||||
ChatUtil.print(" §lCategory " + category);
|
||||
for (Feature feature : BaseBand.features) {
|
||||
Chat.print(" §lCategory " + category);
|
||||
for (Feature feature : Features.features) {
|
||||
if(feature.category != category)
|
||||
continue;
|
||||
TextComponentString comp = new TextComponentString(" " + feature.text);
|
||||
Style style = new Style();
|
||||
style.setClickEvent(new net.minecraft.util.text.event.ClickEvent(net.minecraft.util.text.event.ClickEvent.Action.SUGGEST_COMMAND, Client.prefix + this + " feature " + feature));
|
||||
comp.setStyle(style);
|
||||
ChatUtil.print(comp);
|
||||
Chat.print(comp);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(args[0].equalsIgnoreCase("feature")) {
|
||||
if(args.length != 2) {
|
||||
ChatUtil.print("Invalid syntax.");
|
||||
Chat.print("Invalid syntax.");
|
||||
return;
|
||||
}
|
||||
ChatUtil.print("§c§l" + Setup.Name + " help system: Feature " + args[1]);
|
||||
for (Feature feature : BaseBand.features) {
|
||||
Chat.print("§c§l" + Setup.Name + " help system: Feature " + args[1]);
|
||||
for (Feature feature : Features.features) {
|
||||
if(feature.toString().replace(' ', '_').equalsIgnoreCase(args[1])) {
|
||||
ChatUtil.print(feature.hover);
|
||||
ChatUtil.print("The feature is " + (feature.enabled ? "§aenabled" : "§cdisabled") + ".");
|
||||
ChatUtil.print("It has " + feature.handle.getContent().map.size() + " config entries:");
|
||||
Chat.print(feature.hover);
|
||||
Chat.print("The feature is " + (feature.enabled ? "§aenabled" : "§cdisabled") + ".");
|
||||
Chat.print("It has " + feature.handle.getContent().map.size() + " config entries:");
|
||||
for (TLMap.Entry<String, Object> entry : feature.handle.getContent().map.entries()) {
|
||||
TextComponentString comp = new TextComponentString(" " + entry.key + " = " + entry.val);
|
||||
Style style = new Style();
|
||||
style.setClickEvent(new net.minecraft.util.text.event.ClickEvent(net.minecraft.util.text.event.ClickEvent.Action.SUGGEST_COMMAND, Client.prefix + BaseBand.getFeature(Set.class) + " " + feature.toString().replace(' ', '_') + " " + entry.key.replace(' ', '_') + " "));
|
||||
style.setClickEvent(new net.minecraft.util.text.event.ClickEvent(net.minecraft.util.text.event.ClickEvent.Action.SUGGEST_COMMAND, Client.prefix + Features.getFeature(Set.class) + " " + feature.toString().replace(' ', '_') + " " + entry.key.replace(' ', '_') + " "));
|
||||
comp.setStyle(style);
|
||||
ChatUtil.print(comp);
|
||||
Chat.print(comp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
ChatUtil.print("This feature does not exist.");
|
||||
Chat.print("This feature does not exist.");
|
||||
return;
|
||||
}
|
||||
ChatUtil.print("This action does not exist!");
|
||||
Chat.print("This action does not exist!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,12 +5,12 @@ import com.baseband.client.feature.category.Command;
|
|||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.registry.SetCommand;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.BaseBand.RANDOM;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
@Command
|
||||
public class Set extends Feature {
|
||||
|
@ -18,20 +18,20 @@ public class Set extends Feature {
|
|||
private static final HashMap<Integer, ConfigHandle> quickSet = new HashMap<>();
|
||||
|
||||
public static int addQuickSet(ConfigHandle handle) {
|
||||
int n = GlobalUtil.RANDOM.nextInt(Integer.MAX_VALUE);
|
||||
while(quickSet.containsKey(n)) n = GlobalUtil.RANDOM.nextInt(Integer.MAX_VALUE);
|
||||
int n = RANDOM.nextInt(Integer.MAX_VALUE);
|
||||
while(quickSet.containsKey(n)) n = RANDOM.nextInt(Integer.MAX_VALUE);
|
||||
quickSet.put(n, handle);
|
||||
return n;
|
||||
}
|
||||
|
||||
public static void openQuickSet(int id, String field, boolean showCurrent) {
|
||||
ChatUtil.openChat(Client.prefix + "set " + id + " " + field.replace(' ', '_') + " " + (showCurrent ? quickSet.get(id).getContent().getString(field) : ""));
|
||||
Chat.openChat(Client.prefix + "set " + id + " " + field.replace(' ', '_') + " " + (showCurrent ? quickSet.get(id).getContent().getString(field) : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
if(args.length < 3) {
|
||||
ChatUtil.print("syntax: " + Client.prefix + this + " <module> <setting> <value...>");
|
||||
Chat.print("syntax: " + Client.prefix + this + " <module> <setting> <value...>");
|
||||
return;
|
||||
}
|
||||
String module = args[0];
|
||||
|
@ -57,16 +57,16 @@ public class Set extends Feature {
|
|||
|
||||
if(f == null) {
|
||||
if(isQS)
|
||||
ChatUtil.print("QuickSet " + module + " does not exist. This might be a bug.");
|
||||
Chat.print("QuickSet " + module + " does not exist. This might be a bug.");
|
||||
else
|
||||
ChatUtil.print("Feature " + module + " is not present in this client.");
|
||||
Chat.print("Feature " + module + " is not present in this client.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(f.setWithString(setting.replace('_', ' '), value)) {
|
||||
ChatUtil.print(module + ":" + setting + " has been set: " + value);
|
||||
Chat.print(module + ":" + setting + " has been set: " + value);
|
||||
} else {
|
||||
ChatUtil.print("This value is invalid for setting " + module + ":" + setting + " (or it doesn't exist).");
|
||||
Chat.print("This value is invalid for setting " + module + ":" + setting + " (or it doesn't exist).");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.baseband.client.feature.category.Command;
|
|||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.gui.lib.component.Component;
|
||||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
@Command
|
||||
@Description("Triggers some trigger on some module. This is equivalent to pressing the corresponding button in the GUI. Spaces can be replaced with underscores.")
|
||||
|
@ -15,7 +15,7 @@ public class Trigger extends Feature {
|
|||
@Override
|
||||
public void onCommand(String[] args) {
|
||||
if(args.length != 2) {
|
||||
ChatUtil.print("syntax: " + Client.prefix + this + " <module> <trigger>");
|
||||
Chat.print("syntax: " + Client.prefix + this + " <module> <trigger>");
|
||||
return;
|
||||
}
|
||||
String module = args[0];
|
||||
|
@ -31,7 +31,7 @@ public class Trigger extends Feature {
|
|||
}
|
||||
|
||||
if(f == null) {
|
||||
ChatUtil.print("Feature " + module + " is not present in this client.");
|
||||
Chat.print("Feature " + module + " is not present in this client.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class Trigger extends Feature {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ChatUtil.print("Trigger " + trigger + " is not present in module " + module + ".");
|
||||
Chat.print("Trigger " + trigger + " is not present in module " + module + ".");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.baseband.client.feature.movement;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.Movement;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.registry.annotation.Config;
|
||||
|
@ -9,6 +9,7 @@ import com.baseband.client.registry.annotation.Description;
|
|||
import com.baseband.client.registry.annotation.Gate;
|
||||
import com.baseband.client.registry.annotation.Range;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@Movement
|
||||
|
@ -49,27 +50,27 @@ public class ElytraBot extends Feature {
|
|||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if(!BaseBand.isFeatureEnabled(ElytraFly.class)) {
|
||||
BaseBand.notify("§cElytraBot cannot work without ElytraFly.");
|
||||
if(!Features.isFeatureEnabled(ElytraFly.class)) {
|
||||
Chat.notify("§cElytraBot cannot work without ElytraFly.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
BaseBand.getFeature(ElytraFly.class).blockMovement = true;
|
||||
Features.getFeature(ElytraFly.class).blockMovement = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if(!BaseBand.isFeaturePresent(ElytraFly.class)) {
|
||||
if(!Features.isFeaturePresent(ElytraFly.class)) {
|
||||
return;
|
||||
}
|
||||
BaseBand.getFeature(ElytraFly.class).blockMovement = false;
|
||||
Features.getFeature(ElytraFly.class).blockMovement = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
ElytraFly efly = BaseBand.getFeature(ElytraFly.class);
|
||||
ElytraFly efly = Features.getFeature(ElytraFly.class);
|
||||
if(!efly.enabled) {
|
||||
BaseBand.notify("§cElytraBot cannot work without ElytraFly.");
|
||||
Chat.notify("§cElytraBot cannot work without ElytraFly.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ public class ElytraBot extends Feature {
|
|||
break a;
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
BaseBand.notify("§cInvalid ElytraBot target.");
|
||||
Chat.notify("§cInvalid ElytraBot target.");
|
||||
toggle();
|
||||
return;
|
||||
} else {
|
||||
|
@ -107,7 +108,7 @@ public class ElytraBot extends Feature {
|
|||
break a;
|
||||
}
|
||||
}
|
||||
BaseBand.notify("§cElytraBot couldn't find your target player.");
|
||||
Chat.notify("§cElytraBot couldn't find your target player.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.baseband.client.feature.movement;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.Priority;
|
||||
import com.baseband.client.event.events.MoveEvent;
|
||||
import com.baseband.client.event.events.PacketEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.Movement;
|
||||
import com.baseband.client.feature.client.Timer;
|
||||
import com.baseband.client.mixins.IMinecraft;
|
||||
|
@ -60,12 +60,12 @@ public class Speed extends Feature {
|
|||
text = toString();
|
||||
}
|
||||
|
||||
if(enabled && BaseBand.getFeature(Timer.class).enabled) {
|
||||
BaseBand.getFeature(Timer.class).timerLock = true;
|
||||
BaseBand.getFeature(Timer.class).multiplierLock = 20f * 1.088f;
|
||||
} else if (!enabled && BaseBand.getFeature(Timer.class).enabled){
|
||||
BaseBand.getFeature(Timer.class).timerLock = false;
|
||||
BaseBand.getFeature(Timer.class).multiplierLock = 20f;
|
||||
if(enabled && Features.getFeature(Timer.class).enabled) {
|
||||
Features.getFeature(Timer.class).timerLock = true;
|
||||
Features.getFeature(Timer.class).multiplierLock = 20f * 1.088f;
|
||||
} else if (!enabled && Features.getFeature(Timer.class).enabled){
|
||||
Features.getFeature(Timer.class).timerLock = false;
|
||||
Features.getFeature(Timer.class).multiplierLock = 20f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.baseband.client.registry.annotation.Config;
|
|||
import com.baseband.client.registry.annotation.Description;
|
||||
import com.baseband.client.registry.annotation.Gate;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
@Render
|
||||
public class ClickGUI extends Feature {
|
||||
|
|
|
@ -3,13 +3,13 @@ package com.baseband.client.feature.render;
|
|||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Category;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.Render;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.gui.GuiTheme;
|
||||
import com.baseband.client.registry.annotation.*;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.interact.ServerDataManager;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.render.Pixels;
|
||||
import com.baseband.client.util.render.TextSplitter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -22,7 +22,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
import static com.baseband.client.util.render.TextSplitter.*;
|
||||
|
||||
@Render
|
||||
|
@ -67,7 +68,7 @@ public class HUD extends Feature {
|
|||
}
|
||||
|
||||
public static void notify(String text, int time) {
|
||||
GlobalUtil.LOGGER.info(text);
|
||||
LOGGER.info(text);
|
||||
notifs.add(new Notification(text, time));
|
||||
}
|
||||
|
||||
|
@ -164,7 +165,7 @@ public class HUD extends Feature {
|
|||
public void text(RenderGameOverlayEvent.Text e) {
|
||||
ScaledResolution sr = new ScaledResolution(mc);
|
||||
TextSplitter.init(mc.fontRenderer);
|
||||
GuiTheme.ITheme theme = BaseBand.getFeature(Client.class).getTheme();
|
||||
GuiTheme.ITheme theme = Features.getFeature(Client.class).getTheme();
|
||||
|
||||
String infoString = "";
|
||||
if(showInfo) {
|
||||
|
@ -283,8 +284,8 @@ public class HUD extends Feature {
|
|||
|
||||
@Override
|
||||
protected void setup() {
|
||||
if(BaseBand.isFeaturePresent(ShowTPS.class)) {
|
||||
subComponents.add(BaseBand.getFeature(ShowTPS.class));
|
||||
if(Features.isFeaturePresent(ShowTPS.class)) {
|
||||
subComponents.add(Features.getFeature(ShowTPS.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baseband.client.feature.world;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.World;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import de.tudbut.tools.Lock;
|
||||
import net.minecraft.client.gui.GuiGameOver;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class AutoRespawn extends Feature {
|
|||
if (mc.currentScreen instanceof GuiGameOver && !lock.isLocked()) {
|
||||
mc.player.respawnPlayer();
|
||||
mc.displayGuiScreen(null);
|
||||
BaseBand.notify("[AutoRespawn] Respawned.");
|
||||
Chat.notify("[AutoRespawn] Respawned.");
|
||||
lock.lock(500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.baseband.client.feature.world;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.category.World;
|
||||
import com.baseband.client.feature.render.ClickGUI;
|
||||
import com.baseband.client.registry.annotation.*;
|
||||
import com.baseband.client.util.adapt.Marker;
|
||||
import com.baseband.client.util.adapt.SimpleWorldGenerator;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.render.Pixels;
|
||||
import de.tudbut.tools.Lock;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -23,6 +23,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
import static com.baseband.client.util.render.Tesselator.*;
|
||||
|
||||
@World
|
||||
|
@ -102,32 +103,32 @@ public class SeedOverlay extends Feature {
|
|||
running = true;
|
||||
canSetRD = false;
|
||||
new Thread(() -> {
|
||||
BaseBand.ifFeaturePresent(ClickGUI.class, gui -> gui.setEnabled(false));
|
||||
Features.ifFeaturePresent(ClickGUI.class, gui -> gui.setEnabled(false));
|
||||
long seed;
|
||||
try {
|
||||
seed = Long.parseLong(this.seed);
|
||||
} catch (NumberFormatException e) {
|
||||
seed = this.seed.hashCode();
|
||||
}
|
||||
BaseBand.notify("Creating world with seed " + seed + "...");
|
||||
Chat.notify("Creating world with seed " + seed + "...");
|
||||
int rd = this.rd * 2 + 1;
|
||||
genOverworld = SimpleWorldGenerator.overworld(mc.world.getWorldInfo(), seed, rd);
|
||||
genNether = SimpleWorldGenerator.nether(mc.world.getWorldInfo(), seed, rd);
|
||||
genEnd = SimpleWorldGenerator.end(mc.world.getWorldInfo(), seed, rd);
|
||||
int length = rd * 16 * 256 * rd * 16;
|
||||
BaseBand.notify("World generators acquired. Allocating render buffer with " + (length * 4 / 1024) + "KB space.");
|
||||
Chat.notify("World generators acquired. Allocating render buffer with " + (length * 4 / 1024) + "KB space.");
|
||||
bufferPosition = new BlockPos((mc.player.chunkCoordX - this.rd) * 16, 0, (mc.player.chunkCoordZ - this.rd) * 16);
|
||||
frontBuffer = new int[rd * 16][256][rd * 16];
|
||||
backBuffer = new int[rd * 16][256][rd * 16];
|
||||
GlobalUtil.LOGGER.info("Allocated.");
|
||||
LOGGER.info("Allocated.");
|
||||
for (int x = 0; x < rd * 16; x++) {
|
||||
for (int z = 0; z < rd * 16; z++) {
|
||||
frontBuffer[x][0][z] = 0x800000ff;
|
||||
backBuffer[x][0][z] = 0x800000ff;
|
||||
}
|
||||
}
|
||||
GlobalUtil.LOGGER.info("Filled buffer with unloaded state.");
|
||||
BaseBand.notify("Render buffer created. Starting...");
|
||||
LOGGER.info("Filled buffer with unloaded state.");
|
||||
Chat.notify("Render buffer created. Starting...");
|
||||
setEnabled(true);
|
||||
}, this + " init").start();
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ public class SeedOverlay extends Feature {
|
|||
|
||||
// these should already be stopped!
|
||||
if(updater.isAlive() || generator.isAlive()) {
|
||||
GlobalUtil.LOGGER.warn(this + " threads were still running when stopping the world. This should not happen! Stopping them forcefully.");
|
||||
LOGGER.warn(this + " threads were still running when stopping the world. This should not happen! Stopping them forcefully.");
|
||||
//noinspection deprecation
|
||||
updater.stop();
|
||||
//noinspection deprecation
|
||||
|
@ -167,7 +168,7 @@ public class SeedOverlay extends Feature {
|
|||
backBuffer = null;
|
||||
|
||||
canSetRD = true;
|
||||
GlobalUtil.LOGGER.info("SeedOverlay completely disabled.");
|
||||
LOGGER.info("SeedOverlay completely disabled.");
|
||||
}, this + " stopper").start();
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ public class SeedOverlay extends Feature {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
if(frontBuffer == null) {
|
||||
BaseBand.notify("Please input a |Seed| and trigger |Generate now|");
|
||||
Chat.notify("Please input a |Seed| and trigger |Generate now|");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.baseband.client.feature.world;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.Priority;
|
||||
import com.baseband.client.event.events.SelectEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.category.World;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.baseband.client.util.type.Selection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -18,14 +19,14 @@ public class Select extends Feature {
|
|||
if(end != null || begin == null) {
|
||||
begin = b;
|
||||
end = null;
|
||||
BaseBand.notify("Selection reset.");
|
||||
BaseBand.notify("Position 1: " + b.getX() + " " + b.getY() + " " + b.getZ());
|
||||
BaseBand.publish(new SelectEvent(null));
|
||||
Chat.notify("Selection reset.");
|
||||
Chat.notify("Position 1: " + b.getX() + " " + b.getY() + " " + b.getZ());
|
||||
Configuration.publish(new SelectEvent(null));
|
||||
return;
|
||||
}
|
||||
end = b;
|
||||
BaseBand.notify("Position 2: " + b.getX() + " " + b.getY() + " " + b.getZ());
|
||||
BaseBand.publish(new SelectEvent(new Selection(begin, end)));
|
||||
Chat.notify("Position 2: " + b.getX() + " " + b.getY() + " " + b.getZ());
|
||||
Configuration.publish(new SelectEvent(new Selection(begin, end)));
|
||||
}
|
||||
|
||||
@Priority(Integer.MAX_VALUE)
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.baseband.client.gui;
|
|||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.render.ClickGUI;
|
||||
import com.baseband.client.gui.lib.GUIManager;
|
||||
import com.baseband.client.gui.lib.component.Category;
|
||||
|
@ -16,7 +17,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static com.baseband.client.BaseBand.features;
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
public class GuiRewrite extends GuiScreen {
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class GuiRewrite extends GuiScreen {
|
|||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
BaseBand.getFeature(ClickGUI.class).setEnabled(false);
|
||||
Features.getFeature(ClickGUI.class).setEnabled(false);
|
||||
for (Category category : categories) {
|
||||
com.baseband.client.feature.Category c = com.baseband.client.feature.Category.fromName(category.text);
|
||||
assert c != null;
|
||||
|
@ -174,7 +175,7 @@ public class GuiRewrite extends GuiScreen {
|
|||
}
|
||||
|
||||
// TMP fix for a strange bug that causes the mouse to be hidden
|
||||
if (BaseBand.getFeature(ClickGUI.class).mouseFix) {
|
||||
if (Features.getFeature(ClickGUI.class).mouseFix) {
|
||||
drawRect(mouseX - 2, mouseY - 2, mouseX + 2, mouseY + 2, 0xffffffff);
|
||||
}
|
||||
int m = Mouse.getDWheel();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.gui.lib;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.gui.GuiTheme;
|
||||
import com.baseband.client.gui.lib.component.Component;
|
||||
|
@ -66,7 +66,7 @@ public class GUIManager {
|
|||
}
|
||||
|
||||
public static void update() {
|
||||
GuiTheme.ITheme theme = BaseBand.getFeature(Client.class).getTheme();
|
||||
GuiTheme.ITheme theme = Features.getFeature(Client.class).getTheme();
|
||||
fontColorOn = theme.getGreenColor();
|
||||
fontColorOff = theme.getRedColor();
|
||||
frameColor = theme.getFrameColor();
|
||||
|
|
|
@ -3,12 +3,13 @@ package com.baseband.client.gui.lib.component;
|
|||
import com.baseband.client.feature.command.Set;
|
||||
import com.baseband.client.gui.lib.GUIManager;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class IntSlider extends Component {
|
||||
|
||||
public float f = 0;
|
||||
|
@ -79,7 +80,7 @@ public class IntSlider extends Component {
|
|||
try {
|
||||
f = (handle.getContent().getInteger(field) - adder) / (float) mapper;
|
||||
} catch (NullPointerException e) {
|
||||
GlobalUtil.LOGGER.debug(e.getStackTrace());
|
||||
LOGGER.debug(e.getStackTrace());
|
||||
}
|
||||
if(countdown > 0) {
|
||||
--countdown;
|
||||
|
|
|
@ -3,12 +3,13 @@ package com.baseband.client.gui.lib.component;
|
|||
import com.baseband.client.feature.command.Set;
|
||||
import com.baseband.client.gui.lib.GUIManager;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class Slider extends Component {
|
||||
|
||||
public float f = 0;
|
||||
|
@ -77,7 +78,7 @@ public class Slider extends Component {
|
|||
try {
|
||||
f = (handle.getContent().getFloat(field) - adder) / mapper;
|
||||
} catch (NullPointerException e) {
|
||||
GlobalUtil.LOGGER.debug(e.getStackTrace());
|
||||
LOGGER.debug(e.getStackTrace());
|
||||
}
|
||||
if(countdown > 0) {
|
||||
--countdown;
|
||||
|
|
|
@ -2,7 +2,8 @@ package com.baseband.client.gui.lib.component;
|
|||
|
||||
import com.baseband.client.feature.command.Set;
|
||||
import com.baseband.client.registry.ConfigHandle;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class ToggleButton extends Component {
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class ToggleButton extends Component {
|
|||
try {
|
||||
green = handle.getContent().getBoolean(field);
|
||||
} catch (NullPointerException e) {
|
||||
GlobalUtil.LOGGER.debug(e.getStackTrace());
|
||||
LOGGER.debug(e.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.events.MotionUpdateEvent;
|
||||
import com.baseband.client.event.events.MoveEvent;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
|
@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
public class MixinEntityPlayerSP extends AbstractClientPlayer {
|
||||
|
||||
@Shadow
|
||||
public Minecraft mc;
|
||||
protected Minecraft mc;
|
||||
|
||||
public MixinEntityPlayerSP(World worldIn, GameProfile playerProfile) {
|
||||
super(worldIn, playerProfile);
|
||||
|
@ -55,13 +55,13 @@ public class MixinEntityPlayerSP extends AbstractClientPlayer {
|
|||
|
||||
@Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "HEAD")})
|
||||
private void preMotion(CallbackInfo info) {
|
||||
BaseBand.publish(new MotionUpdateEvent.Pre());
|
||||
Configuration.publish(new MotionUpdateEvent.Pre());
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "RETURN")})
|
||||
private void postMotion(CallbackInfo info) {
|
||||
BaseBand.publish(new MotionUpdateEvent.Post());
|
||||
Configuration.publish(new MotionUpdateEvent.Post());
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class MixinEntityPlayerSP extends AbstractClientPlayer {
|
|||
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;move(Lnet/minecraft/entity/MoverType;DDD)V"), cancellable = true)
|
||||
public void move(MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
|
||||
MoveEvent event = new MoveEvent(p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_);
|
||||
if(!BaseBand.publish(event).isCancelled())
|
||||
if(!Configuration.publish(event).isCancelled())
|
||||
super.move(event.type, event.x, event.y, event.z);
|
||||
ci.cancel();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.render.NoRender;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
|
@ -17,7 +17,7 @@ public class MixinEntityRender {
|
|||
|
||||
@Redirect(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;rayTraceBlocks(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;"))
|
||||
public RayTraceResult rayTraceBlocks(WorldClient world, Vec3d start, Vec3d end) {
|
||||
if (BaseBand.isFeatureEnabled(NoRender.class) && BaseBand.getFeature(NoRender.class).cameraClip)
|
||||
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).cameraClip)
|
||||
return null;
|
||||
else
|
||||
return world.rayTraceBlocks(start, end);
|
||||
|
@ -26,6 +26,6 @@ public class MixinEntityRender {
|
|||
|
||||
@Inject(method = "hurtCameraEffect", at = @At("HEAD"), cancellable = true)
|
||||
public void hurtCameraEffect(float ticks, CallbackInfo info) {
|
||||
if (BaseBand.isFeatureEnabled(NoRender.class) && BaseBand.getFeature(NoRender.class).hurtcam) info.cancel();
|
||||
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).hurtcam) info.cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.world.AutoSignText;
|
||||
import net.minecraft.client.gui.inventory.GuiEditSign;
|
||||
import net.minecraft.tileentity.TileEntitySign;
|
||||
|
@ -21,8 +21,8 @@ public class MixinGuiEditSign {
|
|||
|
||||
@Inject(method = "initGui", at = @At("RETURN"))
|
||||
public void initGui(CallbackInfo callback) {
|
||||
if(BaseBand.isFeatureEnabled(AutoSignText.class)) {
|
||||
AutoSignText autoSignText = BaseBand.getFeature(AutoSignText.class);
|
||||
if(Features.isFeatureEnabled(AutoSignText.class)) {
|
||||
AutoSignText autoSignText = Features.getFeature(AutoSignText.class);
|
||||
tileSign.signText[0] = new TextComponentString(autoSignText.signTextFirst);
|
||||
tileSign.signText[1] = new TextComponentString(autoSignText.signTextSecond);
|
||||
tileSign.signText[2] = new TextComponentString(autoSignText.signTextThird);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.chat.ChatExtras;
|
||||
import net.minecraft.client.gui.ChatLine;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
@ -15,30 +15,30 @@ import java.util.List;
|
|||
public class MixinGuiNewChat extends Gui {
|
||||
@Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"))
|
||||
private void drawRectHook(int left, int top, int right, int bottom, int color) {
|
||||
if(!BaseBand.isFeatureEnabled(ChatExtras.class)) {
|
||||
if(!Features.isFeatureEnabled(ChatExtras.class)) {
|
||||
Gui.drawRect(left, top, right, bottom, color);
|
||||
return;
|
||||
}
|
||||
|
||||
ChatExtras chatExtras = BaseBand.getFeature(ChatExtras.class);
|
||||
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
|
||||
Gui.drawRect(left, top, right, bottom, chatExtras.clearchat ? 0 : color);
|
||||
}
|
||||
|
||||
@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 0, remap = false))
|
||||
public int drawnChatLinesSize(List<ChatLine> list) {
|
||||
if(!BaseBand.isFeatureEnabled(ChatExtras.class))
|
||||
if(!Features.isFeatureEnabled(ChatExtras.class))
|
||||
return list.size();
|
||||
|
||||
ChatExtras chatExtras = BaseBand.getFeature(ChatExtras.class);
|
||||
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
|
||||
return chatExtras.infinitechat ? -2147483647 : list.size();
|
||||
}
|
||||
|
||||
@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 2, remap = false))
|
||||
public int chatLinesSize(List<ChatLine> list) {
|
||||
if(!BaseBand.isFeatureEnabled(ChatExtras.class))
|
||||
if(!Features.isFeatureEnabled(ChatExtras.class))
|
||||
return list.size();
|
||||
|
||||
ChatExtras chatExtras = BaseBand.getFeature(ChatExtras.class);
|
||||
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
|
||||
return chatExtras.infinitechat ? -2147483647 : list.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.event.events.PacketEvent;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
|
@ -15,13 +15,13 @@ public class MixinNetworkManager {
|
|||
|
||||
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
|
||||
public void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
|
||||
if (BaseBand.publish(new PacketEvent.Receive(p_channelRead0_2_)).isCancelled())
|
||||
if (Configuration.publish(new PacketEvent.Receive(p_channelRead0_2_)).isCancelled())
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
|
||||
public void channelRead0(Packet<?> packetIn, CallbackInfo ci) {
|
||||
if (BaseBand.publish(new PacketEvent.Send(packetIn)).isCancelled())
|
||||
if (Configuration.publish(new PacketEvent.Send(packetIn)).isCancelled())
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.baseband.client.mixins;
|
||||
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.util.net.ScreenshotHelper;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
|
@ -17,10 +17,10 @@ import java.io.File;
|
|||
public class MixinScreenshotHelper {
|
||||
@Inject(method = {"saveScreenshot(Ljava/io/File;Ljava/lang/String;IILnet/minecraft/client/shader/Framebuffer;)Lnet/minecraft/util/text/ITextComponent;"}, at = {@At(value = "HEAD")})
|
||||
private static void saveScreenshot(File file, String string, int n, int n2, Framebuffer framebuffer, CallbackInfoReturnable<?> callbackInfoReturnable) {
|
||||
if(!BaseBand.isFeatureEnabled(Client.class))
|
||||
if(!Features.isFeatureEnabled(Client.class))
|
||||
return;
|
||||
|
||||
Client client = BaseBand.getFeature(Client.class);
|
||||
Client client = Features.getFeature(Client.class);
|
||||
if (client.screenshotUpload) {
|
||||
ScreenshotHelper eventClientScreenShot = new ScreenshotHelper(ScreenShotHelper.createScreenshot(n, n2, framebuffer));
|
||||
eventClientScreenShot.start();
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.baseband.client.registry;
|
||||
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import de.tudbut.parsing.TCN;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class ConfigHandle implements SetCommand {
|
||||
|
||||
final String name;
|
||||
|
@ -65,7 +66,7 @@ public class ConfigHandle implements SetCommand {
|
|||
try {
|
||||
updated(setting);
|
||||
} catch(Exception e) {
|
||||
GlobalUtil.LOGGER.info((Object) "Unable to setWithString", e);
|
||||
LOGGER.info((Object) "Unable to setWithString", e);
|
||||
// reset
|
||||
tcn.set(setting, original);
|
||||
updated(setting);
|
||||
|
|
|
@ -1,13 +1,23 @@
|
|||
package com.baseband.client.registry;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.event.Event;
|
||||
import com.baseband.client.event.remote.RemoteEvent;
|
||||
import com.baseband.client.feature.Feature;
|
||||
import com.baseband.client.util.adapt.FieldFinder;
|
||||
import de.tudbut.parsing.TCN;
|
||||
import de.tudbut.tools.Registry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.baseband.client.feature.Features.features;
|
||||
|
||||
public class Configuration {
|
||||
|
||||
public final Registry registry = new Registry(Setup.get().RegistryFilename);
|
||||
public static final ArrayList<Updater> updaters = new ArrayList<>();
|
||||
final Registry registry = new Registry(Setup.get().RegistryFilename);
|
||||
|
||||
private Configuration() throws IOException {
|
||||
}
|
||||
|
@ -34,4 +44,47 @@ public class Configuration {
|
|||
public static void save() {
|
||||
INSTANCE.registry.save();
|
||||
}
|
||||
|
||||
public static Updater registerUpdater(Updater updater) {
|
||||
updaters.add(updater);
|
||||
updater.populate();
|
||||
return updater;
|
||||
}
|
||||
|
||||
public static <T extends Event> T publish(T event) {
|
||||
if(event instanceof RemoteEvent)
|
||||
BaseBand.remoteEventManager.publish((RemoteEvent) event);
|
||||
else
|
||||
BaseBand.eventManager.publish(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public static void cloneConfigFrom(TCN fullDB) {
|
||||
boolean[] wasEnabled = new boolean[features.length];
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
Feature feature = features[i];
|
||||
wasEnabled[i] = feature.enabled;
|
||||
for (ConfigHandle handle : feature.ownedHandles.values()) {
|
||||
handle.cloneFrom(fullDB.getSub(handle.getName()));
|
||||
}
|
||||
}
|
||||
for (Updater updater : updaters) {
|
||||
updater.populate();
|
||||
}
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
if(features[i].enabled != wasEnabled[i]) {
|
||||
features[i].enabled = wasEnabled[i];
|
||||
features[i].toggle();
|
||||
}
|
||||
}
|
||||
PlayerDB.Data.cloneFrom(fullDB.getSub("PlayerData"));
|
||||
}
|
||||
|
||||
public static TCN asTCN() {
|
||||
try {
|
||||
return (TCN) FieldFinder.findUnmarked(Registry.class, TCN.class, 0).get(INSTANCE.registry);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.baseband.client.util.adapt;
|
||||
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import de.tudbut.tools.ReflectUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -31,6 +30,8 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class WorldRecreationGenerator implements IChunkProvider {
|
||||
|
||||
public final World world;
|
||||
|
@ -138,7 +139,7 @@ public class WorldRecreationGenerator implements IChunkProvider {
|
|||
public synchronized boolean tick() {
|
||||
|
||||
if(hasNewChunks) {
|
||||
GlobalUtil.LOGGER.debug(this + ": Creating variations for {} MultiChunks.", realLoaded.size());
|
||||
LOGGER.debug(this + ": Creating variations for {} MultiChunks.", realLoaded.size());
|
||||
int variations = 0;
|
||||
for (Map.Entry<ChunkPos, MultiChunk> entry : realLoaded.entrySet()) {
|
||||
entry.getValue().makeVariations();
|
||||
|
@ -146,12 +147,12 @@ public class WorldRecreationGenerator implements IChunkProvider {
|
|||
for (Map.Entry<ChunkPos, MultiChunk> entry : realLoaded.entrySet()) {
|
||||
variations += entry.getValue().backVariations.size();
|
||||
}
|
||||
GlobalUtil.LOGGER.debug(this + ": Checking {} variations.", variations);
|
||||
LOGGER.debug(this + ": Checking {} variations.", variations);
|
||||
for (Map.Entry<ChunkPos, MultiChunk> entry : realLoaded.entrySet()) {
|
||||
ChunkPos pos = entry.getKey();
|
||||
entry.getValue().findPreferred(mc.world.getChunk(pos.x, pos.z));
|
||||
}
|
||||
GlobalUtil.LOGGER.debug(this + ": Done.");
|
||||
LOGGER.debug(this + ": Done.");
|
||||
|
||||
hasNewChunks = false;
|
||||
}
|
||||
|
@ -173,7 +174,7 @@ public class WorldRecreationGenerator implements IChunkProvider {
|
|||
}
|
||||
|
||||
private void onUnload(ChunkPos pos, Chunk chunk) {
|
||||
GlobalUtil.LOGGER.debug(this + " is unloading chunk at {} {}", pos.x, pos.z);
|
||||
LOGGER.debug(this + " is unloading chunk at {} {}", pos.x, pos.z);
|
||||
chunk.onUnload();
|
||||
loaded.remove(pos);
|
||||
realLoaded.remove(pos);
|
||||
|
@ -244,7 +245,7 @@ public class WorldRecreationGenerator implements IChunkProvider {
|
|||
|
||||
public MultiChunk(Chunk initial, WorldRecreationGenerator generator) {
|
||||
pos = initial.getPos();
|
||||
GlobalUtil.LOGGER.debug(this + ": MultiChunk at {} {} created.", pos.x, pos.z);
|
||||
LOGGER.debug(this + ": MultiChunk at {} {} created.", pos.x, pos.z);
|
||||
this.generator = generator;
|
||||
map = new ChunkPos[] {
|
||||
new ChunkPos(pos.x + 0, pos.z - 1),
|
||||
|
@ -397,7 +398,7 @@ public class WorldRecreationGenerator implements IChunkProvider {
|
|||
variations = backVariations;
|
||||
backVariations = new ArrayList<>();
|
||||
}
|
||||
GlobalUtil.LOGGER.debug(generator + ": preferred state of chunk {} {} is now {}", pos.x, pos.z, preferredState);
|
||||
LOGGER.debug(generator + ": preferred state of chunk {} {} is now {}", pos.x, pos.z, preferredState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import baritone.api.process.IBaritoneProcess;
|
|||
import baritone.api.process.ICustomGoalProcess;
|
||||
import baritone.api.process.PathingCommand;
|
||||
import baritone.api.process.PathingCommandType;
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.event.events.BaritoneEvent;
|
||||
import com.baseband.client.util.interact.ChatUtil;
|
||||
import com.baseband.client.registry.Configuration;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class BaritoneManager {
|
||||
|
@ -18,7 +18,7 @@ public class BaritoneManager {
|
|||
static {
|
||||
//FUTURE!
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(new PauseBaritoneProcess());
|
||||
BaritoneAPI.getSettings().logger.value = ChatUtil::print;
|
||||
BaritoneAPI.getSettings().logger.value = Chat::print;
|
||||
}
|
||||
|
||||
public static IBaritone getBaritone() {
|
||||
|
@ -55,7 +55,7 @@ public class BaritoneManager {
|
|||
@Override
|
||||
public boolean isActive() {
|
||||
BaritoneEvent event = new BaritoneEvent();
|
||||
BaseBand.publish(event);
|
||||
Configuration.publish(event);
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.baseband.client.util.baritone;
|
||||
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class BaritonePresenceManager {
|
||||
|
||||
|
@ -20,12 +20,12 @@ public class BaritonePresenceManager {
|
|||
}
|
||||
|
||||
if (IS_BARITONE_PRESENT) {
|
||||
GlobalUtil.LOGGER.info("Baritone is present!");
|
||||
LOGGER.info("Baritone is present!");
|
||||
|
||||
try {
|
||||
BaritoneManager.getBaritone();
|
||||
} catch (Throwable e) {
|
||||
GlobalUtil.LOGGER.warn("Baritone is allegedly present but cannot seem to load!");
|
||||
LOGGER.warn("Baritone is allegedly present but cannot seem to load!");
|
||||
IS_BARITONE_PRESENT = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.baseband.client.util.interact;
|
||||
|
||||
import com.baseband.client.Setup;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.client.Client;
|
||||
import com.baseband.client.feature.render.HUD;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
|
@ -11,7 +14,9 @@ import net.minecraft.util.text.TextFormatting;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class ChatUtil {
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class Chat {
|
||||
//forge sucks balls so hard omg
|
||||
public static void print(String s) {
|
||||
if(Minecraft.getMinecraft().player != null) {
|
||||
|
@ -63,4 +68,22 @@ public class ChatUtil {
|
|||
Minecraft.getMinecraft().player.sendChatMessage(msg);
|
||||
}
|
||||
|
||||
public static void notify(String text) {
|
||||
Client c = Features.getFeature(Client.class);
|
||||
if(Features.isFeatureEnabled(HUD.class) && c.notificationDest != Client.NotificationDest.Chat) {
|
||||
HUD.notifs.add(new HUD.Notification(text));
|
||||
if(c.notificationDest == Client.NotificationDest.Both)
|
||||
print(text);
|
||||
else
|
||||
LOGGER.info(text);
|
||||
} else
|
||||
print(text);
|
||||
}
|
||||
|
||||
public static void notifyAll(String text) {
|
||||
if(Features.isFeatureEnabled(HUD.class)) {
|
||||
HUD.notifs.add(new HUD.Notification(text));
|
||||
}
|
||||
print(text);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.util.interact;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.feature.Features;
|
||||
import com.baseband.client.feature.render.Freecam;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityOtherPlayerMP;
|
||||
|
@ -49,7 +49,7 @@ public class FreecamPlayer extends EntityOtherPlayerMP
|
|||
public void onLivingUpdate()
|
||||
{
|
||||
if(mc.world == null) {
|
||||
BaseBand.getFeature(Freecam.class).setEnabled(false);
|
||||
Features.getFeature(Freecam.class).setEnabled(false);
|
||||
return;
|
||||
}
|
||||
mc.renderChunksMany = false;
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package com.baseband.client.util.misc;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
public class GlobalUtil {
|
||||
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
|
||||
public static final SecureRandom RANDOM = new SecureRandom();
|
||||
public static final Runnable SHUTDOWN = () -> {
|
||||
try {
|
||||
Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
|
||||
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
|
||||
exitMethod.setAccessible(true);
|
||||
exitMethod.invoke(null, 0);
|
||||
} catch (Exception ignored) {}
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.baseband.client.util.net;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.util.interact.Chat;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -38,7 +38,7 @@ public class ScreenshotHelper extends Thread {
|
|||
private static void copyAndPrint(StringSelection stringSelection, String string) {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
BaseBand.notify("Image uploaded to: " + string);
|
||||
Chat.notify("Image uploaded to: " + string);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.baseband.client.util.net;
|
||||
|
||||
import com.baseband.client.util.misc.GlobalUtil;
|
||||
import com.baseband.client.BaseBand;
|
||||
import de.tudbut.net.ws.Client;
|
||||
import de.tudbut.net.ws.ConnectionHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.baseband.client.BaseBand.LOGGER;
|
||||
|
||||
public class WebServiceClient {
|
||||
@SuppressWarnings("FieldCanBeLocal") // not finished yet
|
||||
private static Client client;
|
||||
|
@ -15,8 +17,8 @@ public class WebServiceClient {
|
|||
client = new Client("azidoazideazi.de", 30000);
|
||||
//client.addReceiveHook(READER);
|
||||
} catch (IOException e) {
|
||||
GlobalUtil.LOGGER.fatal(e);
|
||||
GlobalUtil.SHUTDOWN.run();
|
||||
LOGGER.fatal(e);
|
||||
BaseBand.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue