Refactor and Profanity
This commit is contained in:
parent
fd5578a335
commit
891657816f
14 changed files with 189 additions and 547 deletions
|
@ -1,5 +1,3 @@
|
|||
import java.security.MessageDigest
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
|
@ -90,37 +88,6 @@ dependencies {
|
|||
implementation configurations.jarLibs
|
||||
}
|
||||
|
||||
compileJava {
|
||||
|
||||
def srcDir = file('src') // Replace 'src' with the actual source directory path
|
||||
|
||||
if (!srcDir.isDirectory()) {
|
||||
throw new GradleException("The 'src' directory does not exist.")
|
||||
}
|
||||
|
||||
// Calculate the hash of the source directory
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256")
|
||||
srcDir.traverse { file ->
|
||||
if (file.isFile()) {
|
||||
md.update(file.bytes)
|
||||
}
|
||||
}
|
||||
def hashBytes = md.digest()
|
||||
// Convert the hash to a 16-character hexadecimal string
|
||||
def hash = hashBytes.encodeHex().toString().substring(0,16);
|
||||
|
||||
|
||||
|
||||
|
||||
/*def targetFile = file("src/main/java/com/baseband/client/BaseBand.java")
|
||||
def content = targetFile.text
|
||||
def updatedContent = content.replaceFirst("buildNumber = (\\d+)", { _, value -> "buildNumber = ${value.toInteger() + 1}" })
|
||||
updatedContent = updatedContent.replaceFirst("public static String hash = \".*\";", "public static String hash = \"" + hash + "\";")
|
||||
updatedContent = updatedContent.replaceFirst("public long timeOfCompile = .*;", "public long timeOfCompile = " + new Date().getTime() + "L;")
|
||||
|
||||
targetFile.text = updatedContent*/
|
||||
}
|
||||
|
||||
processResources {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
|
@ -150,4 +117,21 @@ jar {
|
|||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
baseName = ''
|
||||
version = ''
|
||||
classifier = 'BaseBand-Oslo'
|
||||
}
|
||||
|
||||
|
||||
task releaseJar(type: Jar, dependsOn: jar) {
|
||||
from(zipTree(jar.archivePath)) {
|
||||
exclude 'com/baseband/client/DevStub.class'
|
||||
exclude 'com/baseband/client/DevStub.java'
|
||||
}
|
||||
baseName = ''
|
||||
version = ''
|
||||
classifier = 'BaseBand-Broadway'
|
||||
}
|
||||
|
||||
build.dependsOn(releaseJar)
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package com.baseband.client;
|
||||
|
||||
import com.baseband.client.configuration.Updater;
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.gui.GuiRewrite;
|
||||
import com.baseband.client.module.Feature;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Mod(modid = "baseband_testing")
|
||||
|
||||
public class BaseBand {
|
||||
|
||||
public static BaseBand INSTANCE; { INSTANCE = this; }
|
||||
private static ArrayList<Updater> updaters = new ArrayList<>();
|
||||
public GuiRewrite guiRewrite;
|
||||
|
||||
|
||||
public static Minecraft mc;
|
||||
|
@ -25,20 +25,17 @@ public class BaseBand {
|
|||
}
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onInit(FMLPostInitializationEvent event) {
|
||||
onInit();
|
||||
}
|
||||
|
||||
public void onInit() {
|
||||
mc = Minecraft.getMinecraft();
|
||||
|
||||
Setup clientSetup = Setup.get();
|
||||
Module[] modules = clientSetup.MODULES;
|
||||
for (int i = 0; i < modules.length; i++) {
|
||||
modules[i].register(this, mc);
|
||||
Feature[] features = clientSetup.Features;
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
features[i].register(this, mc);
|
||||
}
|
||||
|
||||
guiRewrite = new GuiRewrite();
|
||||
|
||||
for (Updater updater : updaters) {
|
||||
System.out.println("populating updater " + updater);
|
||||
updater.populate();
|
||||
|
@ -58,15 +55,16 @@ public class BaseBand {
|
|||
}
|
||||
}).start();
|
||||
|
||||
|
||||
new Thread(() -> JOptionPane.showMessageDialog(null, "Gaming")).start();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static <T extends Module> T getModule(Class<? extends T> clazz) {
|
||||
Module[] modules = Setup.get().MODULES;
|
||||
for (int i = 0; i < modules.length; i++) {
|
||||
if(modules[i].getClass() == clazz) {
|
||||
return (T) modules[i];
|
||||
public static <T extends Feature> T getModule(Class<? extends T> clazz) {
|
||||
Feature[] features = Setup.get().Features;
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
if(features[i].getClass() == clazz) {
|
||||
return (T) features[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
12
Client/src/main/java/com/baseband/client/DevStub.java
Normal file
12
Client/src/main/java/com/baseband/client/DevStub.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package com.baseband.client;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
|
||||
@Mod(modid = "baseband_testing")
|
||||
public class DevStub {
|
||||
@Mod.EventHandler
|
||||
public void onInit(FMLPostInitializationEvent event) {
|
||||
BaseBand.INSTANCE.onInit();
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
package com.baseband.client;
|
||||
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.module.Feature;
|
||||
import com.baseband.client.module.command.Test;
|
||||
import com.baseband.client.module.render.ClickGUI;
|
||||
|
||||
/**
|
||||
* @author TudbuT
|
||||
*
|
||||
* Client setup: Included modules, etc.
|
||||
* Client setup: Included features, etc.
|
||||
*/
|
||||
public class Setup {
|
||||
|
||||
public final String REGISTRY_FILENAME = "baseband.db";
|
||||
public final Module[] MODULES = new Module[] {
|
||||
public final Feature[] Features = new Feature[] {
|
||||
new Test(),
|
||||
new ClickGUI()
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baseband.client.Setup;
|
|||
import com.baseband.client.gui.lib.GUIManager;
|
||||
import com.baseband.client.gui.lib.component.Category;
|
||||
import com.baseband.client.gui.lib.component.Component;
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.module.Feature;
|
||||
import com.baseband.client.module.render.ClickGUI;
|
||||
import de.tudbut.obj.TLMap;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
@ -51,19 +51,19 @@ public class GuiRewrite extends GuiScreen {
|
|||
ArrayList<Category> categories = new ArrayList<>();
|
||||
int y = 10;
|
||||
TLMap<com.baseband.client.module.Category, Category> map = new TLMap<>();
|
||||
for (int i = 0 ; i < Setup.get().MODULES.length ; i++) {
|
||||
Module module = Setup.get().MODULES[i];
|
||||
if(!module.displayOnClickGUI()) {
|
||||
for (int i = 0; i < Setup.get().Features.length ; i++) {
|
||||
Feature feature = Setup.get().Features[i];
|
||||
if(!feature.displayOnClickGUI()) {
|
||||
continue;
|
||||
}
|
||||
Category category;
|
||||
if((category = map.get(module.category)) == null) {
|
||||
map.set(module.category, category = new Category() {{
|
||||
text = module.category.name;
|
||||
if((category = map.get(feature.category)) == null) {
|
||||
map.set(feature.category, category = new Category() {{
|
||||
text = feature.category.name;
|
||||
}});
|
||||
if((module.category.x | module.category.y) != 0) {
|
||||
category.location = new Point(module.category.x, module.category.y);
|
||||
category.subComponentsShown = module.category.show;
|
||||
if((feature.category.x | feature.category.y) != 0) {
|
||||
category.location = new Point(feature.category.x, feature.category.y);
|
||||
category.subComponentsShown = feature.category.show;
|
||||
}
|
||||
if(category.location == null) {
|
||||
category.location = new Point(10, y);
|
||||
|
@ -72,7 +72,7 @@ public class GuiRewrite extends GuiScreen {
|
|||
categories.add(category);
|
||||
category.subComponents.clear();
|
||||
}
|
||||
category.subComponents.add(module);
|
||||
category.subComponents.add(feature);
|
||||
}
|
||||
this.categories = categories.toArray(new Category[0]);
|
||||
}
|
||||
|
|
|
@ -1,429 +0,0 @@
|
|||
package com.baseband.client.gui;
|
||||
|
||||
import com.baseband.client.module.Module;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class GuiTTC extends GuiScreen {
|
||||
|
||||
// The buttons to be rendered (sub buttons are in the button object)
|
||||
// One button per module
|
||||
private Button[] buttons;
|
||||
|
||||
// Theme
|
||||
public interface ITheme {
|
||||
int getGreenColor();
|
||||
int getRedColor();
|
||||
int getFrameColor();
|
||||
int getBackgroundColor();
|
||||
}
|
||||
public enum Theme implements ITheme {
|
||||
TTC(0xff80ff00, 0xff008800),
|
||||
ETERNAL_BLUE(0xff4040ff, 0xffff0000, 0xffffffff, 0xff000030),
|
||||
DARK(0xff008000, 0xff800000, 0xff808080, 0xff000000),
|
||||
LIGHT(0xffcccccc, 0xff999999),
|
||||
BLOOD(0xffaa0000, 0xff880000, 0xff00ffff, 0xaaaaaaaa),
|
||||
SKY(0xff00cccc, 0xff009999, 0x000000),
|
||||
KAMI_BLUE(0xbb353642, 0xbb353642, 0xffbbbbbb, 0xaaaaaaaa),
|
||||
SCHLONGHAX(0xbb553662, 0xbb553662, 0xffbbbbbb, 0xaaaaaaaa),
|
||||
ORANGE(0xffcc8000, 0xff996000, 0xff404040),
|
||||
XV11(0xff3f718e, 0xff2d2d2d, 0xff67915f, 0xff000000),
|
||||
TTC_OLD(0xff00ff00, 0xffff0000),
|
||||
SOBERSHULKER(0xffff88ff, 0xffaa40aa, 0xffff88ff, 0xff000000),
|
||||
VIRUS(0xffc0ddff, 0xffffffff, 0x00000000, 0xaa202040),
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public int getGreenColor() {
|
||||
return greenColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedColor() {
|
||||
return redColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFrameColor() {
|
||||
return frameColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public final int greenColor;
|
||||
public final int redColor;
|
||||
public final int frameColor;
|
||||
public final int backgroundColor;
|
||||
|
||||
Theme(int greenColor, int redColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = 0xffffffff;
|
||||
this.backgroundColor = 0xA0000000;
|
||||
}
|
||||
Theme(int greenColor, int redColor, int frameColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = frameColor;
|
||||
this.backgroundColor = 0xA0000000;
|
||||
}
|
||||
Theme(int greenColor, int redColor, int frameColor, int backgroundColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = frameColor;
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// The mouse X and Y
|
||||
private int cx;
|
||||
private int cy;
|
||||
private int lastScrollPos = Mouse.getEventDWheel();
|
||||
|
||||
public GuiTTC() {
|
||||
this.mc = TTCp.mc;
|
||||
}
|
||||
|
||||
// Minecraft wants this
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
return mc.player.timeInPortal != 0;
|
||||
}
|
||||
|
||||
// The initiator, this can, for some reason, not be in the constructor
|
||||
public void initGui() {
|
||||
// Creates buttons
|
||||
buttons = new Button[256];
|
||||
resetButtons();
|
||||
|
||||
// Minecraft wants this
|
||||
super.buttonList.clear();
|
||||
super.buttonList.add(new GuiButton(0, -500, -500, ""));
|
||||
super.initGui();
|
||||
lastScrollPos = Mouse.getEventDWheel();
|
||||
}
|
||||
|
||||
// When ESC is pressed
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
ClickGUI.getInstance().enabled = false;
|
||||
}
|
||||
|
||||
// Called every tick, idk why its called update tho
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
// Minecraft is stupid and sometimes forgets to call initScreen, so this is needed
|
||||
while (buttons == null) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (buttons == null)
|
||||
resetButtons();
|
||||
}
|
||||
// Call onTick on every button
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
if (buttons[i] != null)
|
||||
buttons[i].onTick(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the buttons array
|
||||
public void resetButtons() {
|
||||
Button[] buttons = new Button[TTCp.modules.length];
|
||||
for (int i = 0, j = 0; i < TTCp.modules.length; i++) {
|
||||
int x = j / 15;
|
||||
int y = j - x * 15;
|
||||
|
||||
// Don't add the button if it isn't requested
|
||||
if (!TTCp.modules[i].displayOnClickGUI())
|
||||
continue;
|
||||
|
||||
// Create the button
|
||||
int r = i;
|
||||
Button b = new Button(
|
||||
10 + (155 * x), 10 + (y * 25), TTCp.modules[r].toString() + ": " + TTCp.modules[r].enabled,
|
||||
(text) -> {
|
||||
if (TTCp.modules[r].enabled = !TTCp.modules[r].enabled)
|
||||
TTCp.modules[r].onEnable();
|
||||
else
|
||||
TTCp.modules[r].onDisable();
|
||||
|
||||
}, TTCp.modules[i]
|
||||
);
|
||||
buttons[i] = b;
|
||||
|
||||
j++;
|
||||
}
|
||||
this.buttons = buttons;
|
||||
}
|
||||
|
||||
// Reset text on the buttons
|
||||
private void updateButtons() {
|
||||
while (buttons == null) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (buttons == null)
|
||||
resetButtons();
|
||||
}
|
||||
for (int i = 0; i < TTCp.modules.length; i++) {
|
||||
if (buttons[i] != null)
|
||||
buttons[i].text.set(TTCp.modules[i].toString() + ": " + TTCp.modules[i].enabled);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the user presses a mouse button
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
// Update cx and cy
|
||||
cx = mouseX;
|
||||
cy = mouseY;
|
||||
|
||||
// Notify buttons
|
||||
for (int i = 0 ; i < buttons.length ; i++) {
|
||||
Button button = buttons[i];
|
||||
if (button != null)
|
||||
if (button.mouseClicked(mouseX, mouseY, mouseButton))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update cx and cy
|
||||
@Override
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
cx = mouseX;
|
||||
cy = mouseY;
|
||||
}
|
||||
|
||||
// Called when the user releases a mouse button
|
||||
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||
super.mouseReleased(mouseX, mouseY, state);
|
||||
|
||||
// Update cx and cy
|
||||
cx = mouseX;
|
||||
cy = mouseY;
|
||||
|
||||
// Notify buttons
|
||||
for (int i = 0 ; i < buttons.length ; i++) {
|
||||
Button button = buttons[i];
|
||||
if (button != null)
|
||||
button.mouseReleased();
|
||||
}
|
||||
}
|
||||
|
||||
// Render the screen
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
updateButtons();
|
||||
|
||||
this.drawDefaultBackground();
|
||||
|
||||
cx = mouseX;
|
||||
cy = mouseY;
|
||||
|
||||
// Ask the buttons to render themselves
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
if (buttons[i] != null)
|
||||
buttons[i].draw(this);
|
||||
}
|
||||
|
||||
// TMP fix for a strange bug that causes the mouse to be hidden
|
||||
if (ClickGUI.getInstance().mouseFix) {
|
||||
drawRect(mouseX - 2, mouseY - 2, mouseX + 2, mouseY + 2, 0xffffffff);
|
||||
}
|
||||
int m = -Mouse.getDWheel();
|
||||
if(m != 0) {
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
if(buttons[i] != null) {
|
||||
int d = (lastScrollPos - m) / 3;
|
||||
switch (ClickGUI.getInstance().sd) {
|
||||
case Vertical:
|
||||
buttons[i].y += d;
|
||||
break;
|
||||
case Horizontal:
|
||||
buttons[i].x += d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
|
||||
public static class Button {
|
||||
public int x, y;
|
||||
public AtomicReference<String> text;
|
||||
// Color for rendering
|
||||
public int color = 0x8000ff00;
|
||||
// The associated module, can be null if it is a sub button
|
||||
public Module module;
|
||||
// Called when the button is clicked
|
||||
ButtonClickEvent event;
|
||||
// If any mouse button is pressed
|
||||
private boolean mouseDown = false;
|
||||
// The mouse button that is pressed
|
||||
private int mouseDownButton = 0;
|
||||
// The sub buttons of the button, null if no module is associated to provide them
|
||||
private Button[] subButtons;
|
||||
|
||||
private boolean display = true;
|
||||
|
||||
// Constructor used for sub buttons
|
||||
public Button(String text, ButtonClickEvent event) {
|
||||
this(0, 0, text, event, null);
|
||||
}
|
||||
|
||||
// Constructor used by GuiTTC to construct a button with an associated module
|
||||
// and main constructor
|
||||
public Button(int x, int y, String text, ButtonClickEvent event, Module module) {
|
||||
if (module != null) {
|
||||
if (module.clickGuiX != null && module.clickGuiY != null) {
|
||||
x = module.clickGuiX;
|
||||
y = module.clickGuiY;
|
||||
}
|
||||
subButtons = module.subButtons.toArray(new Button[0]);
|
||||
display = module.displayOnClickGUI();
|
||||
}
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.text = new AtomicReference<>(text);
|
||||
this.event = event;
|
||||
this.module = module;
|
||||
if(ClickGUI.getInstance() != null)
|
||||
this.color = ClickGUI.getInstance().getTheme().getGreenColor();
|
||||
}
|
||||
|
||||
// Render the button
|
||||
public void draw(GuiTTC gui) {
|
||||
if (!display)
|
||||
return;
|
||||
|
||||
int color = this.color;
|
||||
|
||||
if (gui.cx >= x && gui.cy >= y && gui.cx <= x + 150 && gui.cy <= y + ySize()) {
|
||||
Color c = new Color(color, true);
|
||||
int r, g, b, a;
|
||||
r = c.getRed();
|
||||
g = c.getGreen();
|
||||
b = c.getBlue();
|
||||
a = c.getAlpha();
|
||||
r += 0x20;
|
||||
g += 0x20;
|
||||
b += 0x20;
|
||||
a += 0x20;
|
||||
color = new Color(Math.min(r, 0xff),Math.min(g, 0xff),Math.min(b, 0xff),Math.min(a, 0xff)).getRGB();
|
||||
}
|
||||
|
||||
drawRect(x, y, x + 150, y + ySize(), color);
|
||||
//gui.fontRenderer.drawString(text.get(), x + 6, y + ySize() / 2f - 8 / 2f, ClickGUI.getInstance().getTheme().getFrameColor(), ClickGUI.getInstance().getTheme().hasShadow());
|
||||
|
||||
// Draw sub buttons
|
||||
if (module != null && (module.enabled ^ module.clickGuiShow)) {
|
||||
//subButtons = module.getSubButtons();
|
||||
|
||||
for (int i = 0; i < subButtons.length; i++) {
|
||||
Button b = subButtons[i];
|
||||
if(b != null) {
|
||||
b.x = x;
|
||||
b.y = y + ( ( i + 1 ) * 15 + ( 20 - 15 ) );
|
||||
b.color = ClickGUI.getInstance().getTheme().getRedColor();
|
||||
b.draw(gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ySize() {
|
||||
return module == null ? 15 : 20;
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int clickX, int clickY, int button) {
|
||||
if (clickX >= x && clickY >= y) {
|
||||
if (clickX < x + 150 && clickY < y + ySize()) {
|
||||
mouseDown = true;
|
||||
if(ClickGUI.getInstance().flipButtons) {
|
||||
button = (button == 0 ? 1 : (button == 1 ? 0 : button));
|
||||
}
|
||||
mouseDownButton = button;
|
||||
click(button);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (module != null && (module.enabled ^ module.clickGuiShow)) {
|
||||
//subButtons = module.getSubButtons();
|
||||
|
||||
for (int i = 0; i < subButtons.length; i++) {
|
||||
Button b = subButtons[i];
|
||||
if(b != null) {
|
||||
b.x = x;
|
||||
b.y = y + ( ( i + 1 ) * 15 + ( 20 - 15 ) );
|
||||
b.color = ClickGUI.getInstance().getTheme().getRedColor();
|
||||
if (b.mouseClicked(clickX, clickY, button))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void mouseReleased() {
|
||||
mouseDown = false;
|
||||
if (module != null && (module.enabled ^ module.clickGuiShow)) {
|
||||
subButtons = module.subButtons.toArray(new Button[0]);
|
||||
|
||||
for (int i = 0; i < subButtons.length; i++) {
|
||||
subButtons[i].mouseReleased();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// More simple onCLick, only called when the mouse is clicked while on the button
|
||||
protected void click(int button) {
|
||||
if (button == 0)
|
||||
event.run(text);
|
||||
if (button == 2 && module != null)
|
||||
module.clickGuiShow = !module.clickGuiShow;
|
||||
}
|
||||
|
||||
protected void onTick(GuiTTC gui) {
|
||||
this.color = ClickGUI.getInstance().getTheme().getGreenColor();
|
||||
if (module != null) {
|
||||
if (mouseDown && mouseDownButton == 1) {
|
||||
x = gui.cx - 150 / 2;
|
||||
y = gui.cy - 10;
|
||||
x = (x / 5) * 5;
|
||||
y = (y / 5) * 5;
|
||||
}
|
||||
module.clickGuiX = x;
|
||||
module.clickGuiY = y;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface ButtonClickEvent {
|
||||
void run(AtomicReference<String> text);
|
||||
}*/
|
||||
}
|
69
Client/src/main/java/com/baseband/client/gui/GuiTheme.java
Normal file
69
Client/src/main/java/com/baseband/client/gui/GuiTheme.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package com.baseband.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiTheme extends GuiScreen {
|
||||
// Theme
|
||||
public interface ITheme {
|
||||
int getGreenColor();
|
||||
int getRedColor();
|
||||
int getFrameColor();
|
||||
int getBackgroundColor();
|
||||
}
|
||||
public enum Theme implements ITheme {
|
||||
TTC(0xff80ff00, 0xff008800),
|
||||
ETERNAL_BLUE(0xff4040ff, 0xffff0000, 0xffffffff, 0xff000030),
|
||||
DARK(0xff008000, 0xff800000, 0xff808080, 0xff000000),
|
||||
LIGHT(0xffcccccc, 0xff999999),
|
||||
BLOOD(0xffaa0000, 0xff880000, 0xff00ffff, 0xaaaaaaaa),
|
||||
SKY(0xff00cccc, 0xff009999, 0x000000),
|
||||
KAMI_BLUE(0xbb353642, 0xbb353642, 0xffbbbbbb, 0xaaaaaaaa),
|
||||
ORANGE(0xffcc8000, 0xff996000, 0xff404040),
|
||||
TTC_OLD(0xff00ff00, 0xffff0000),
|
||||
;
|
||||
|
||||
@Override
|
||||
public int getGreenColor() {
|
||||
return greenColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRedColor() {
|
||||
return redColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFrameColor() {
|
||||
return frameColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public final int greenColor;
|
||||
public final int redColor;
|
||||
public final int frameColor;
|
||||
public final int backgroundColor;
|
||||
|
||||
Theme(int greenColor, int redColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = 0xffffffff;
|
||||
this.backgroundColor = 0xA0000000;
|
||||
}
|
||||
Theme(int greenColor, int redColor, int frameColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = frameColor;
|
||||
this.backgroundColor = 0xA0000000;
|
||||
}
|
||||
Theme(int greenColor, int redColor, int frameColor, int backgroundColor) {
|
||||
this.greenColor = greenColor;
|
||||
this.redColor = redColor;
|
||||
this.frameColor = frameColor;
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.baseband.client.gui.lib;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.gui.GuiTTC;
|
||||
import com.baseband.client.gui.GuiTheme;
|
||||
import com.baseband.client.gui.lib.component.Component;
|
||||
import com.baseband.client.module.render.ClickGUI;
|
||||
import org.lwjgl.util.Rectangle;
|
||||
|
@ -52,7 +52,7 @@ public class GUIManager {
|
|||
}
|
||||
|
||||
public static void update() {
|
||||
GuiTTC.ITheme theme = BaseBand.getModule(ClickGUI.class).getTheme();
|
||||
GuiTheme.ITheme theme = BaseBand.getModule(ClickGUI.class).getTheme();
|
||||
fontColorOn = theme.getGreenColor();
|
||||
fontColorOff = theme.getRedColor();
|
||||
frameColor = theme.getFrameColor();
|
||||
|
|
|
@ -18,7 +18,9 @@ import java.util.HashMap;
|
|||
/**
|
||||
* @author TudbuT
|
||||
*/
|
||||
public abstract class Module extends ToggleButton {
|
||||
|
||||
//Double fuck you if this involves commands too then it's a feature not a module
|
||||
public abstract class Feature extends ToggleButton {
|
||||
|
||||
protected BaseBand bb;
|
||||
protected Minecraft mc;
|
||||
|
@ -28,7 +30,7 @@ public abstract class Module extends ToggleButton {
|
|||
@Marker(1)
|
||||
public boolean enabled = defaultEnable();
|
||||
|
||||
public Module() {
|
||||
public Feature() {
|
||||
super("Uninit", null, "Enabled");
|
||||
|
||||
this.text = toString();
|
||||
|
@ -104,7 +106,7 @@ public abstract class Module extends ToggleButton {
|
|||
}
|
||||
|
||||
handle = settings;
|
||||
BaseBand.registerUpdater(settings.linkWith(this, FieldUtil.findMarked(Module.class, 1)).name("Enabled"));
|
||||
BaseBand.registerUpdater(settings.linkWith(this, FieldUtil.findMarked(Feature.class, 1)).name("Enabled"));
|
||||
|
||||
setup();
|
||||
}
|
||||
|
@ -139,7 +141,7 @@ public abstract class Module extends ToggleButton {
|
|||
try {
|
||||
ConfigHandle h = Configuration.register(getID() + "/" + handle);
|
||||
ownedHandles.put(handle, h);
|
||||
System.out.println("Module " + toString() + " registered config: " + handle);
|
||||
System.out.println("Feature " + toString() + " registered config: " + handle);
|
||||
return h;
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
|
@ -2,7 +2,7 @@ package com.baseband.client.module.command;
|
|||
|
||||
import com.baseband.client.configuration.annotation.Config;
|
||||
import com.baseband.client.configuration.annotation.Range;
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.module.Feature;
|
||||
import com.baseband.client.module.category.Command;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import com.baseband.client.module.category.Command;
|
|||
* Self-Test command, checks if everything is working
|
||||
*/
|
||||
@Command
|
||||
public class Test extends Module {
|
||||
public class Test extends Feature {
|
||||
|
||||
@Config("Int Setting")
|
||||
@Range("0..10")
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.baseband.client.module.render;
|
||||
|
||||
import com.baseband.client.BaseBand;
|
||||
import com.baseband.client.configuration.annotation.Config;
|
||||
import com.baseband.client.gui.GuiTTC;
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.gui.GuiTheme;
|
||||
import com.baseband.client.module.Feature;
|
||||
import com.baseband.client.module.category.Render;
|
||||
|
||||
@Render
|
||||
public class ClickGUI extends Module {
|
||||
public class ClickGUI extends Feature {
|
||||
@Config("Mouse Fix")
|
||||
public boolean mouseFix;
|
||||
|
||||
|
@ -15,7 +16,19 @@ public class ClickGUI extends Module {
|
|||
return "ClickGUI";
|
||||
}
|
||||
|
||||
public GuiTTC.ITheme getTheme() {
|
||||
return GuiTTC.Theme.TTC;
|
||||
public GuiTheme.ITheme getTheme() {
|
||||
return GuiTheme.Theme.TTC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
new Thread(() -> { //fuck you
|
||||
try {
|
||||
wait(300);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
mc.displayGuiScreen(BaseBand.INSTANCE.guiRewrite);
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import net.minecraft.launchwrapper.Launch;
|
|||
import org.baseband.launcher.Loader;
|
||||
import org.baseband.launcher.url.ByteWrapper;
|
||||
import org.baseband.launcher.util.Util;
|
||||
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
|
@ -75,4 +77,32 @@ public class CustomClassLoader extends ClassLoader implements Util {
|
|||
}
|
||||
return super.findClass(name);
|
||||
}
|
||||
|
||||
//TODO: double insecure tud please rewrite this
|
||||
//but remember it's also bloat i wanna keep it outside of the CustomClassLoader ok?
|
||||
public class CustomMixinServer extends MixinServiceLaunchWrapper {
|
||||
Map<String, byte[]> resources;
|
||||
|
||||
public CustomMixinServer(Map<String, byte[]> resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getClassBytes(String name, String transformedName) throws IOException {
|
||||
byte[] bytes = resources.get(name);
|
||||
if (bytes != null) {
|
||||
return bytes;
|
||||
}
|
||||
return super.getClassBytes(name, transformedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getClassBytes(String name, boolean runTransformers) throws ClassNotFoundException, IOException {
|
||||
byte[] bytes = resources.get(name);
|
||||
if (bytes != null) {
|
||||
return bytes;
|
||||
}
|
||||
return super.getClassBytes(name, runTransformers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package org.baseband.launcher.classloader;
|
||||
|
||||
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
//TODO: double insecure tud please rewrite this
|
||||
//but remember it's also bloat i wanna keep it outside of the CustomClassLoader ok?
|
||||
public class CustomMixinServer extends MixinServiceLaunchWrapper {
|
||||
Map<String, byte[]> resources;
|
||||
|
||||
public CustomMixinServer(Map<String, byte[]> resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getClassBytes(String name, String transformedName) throws IOException {
|
||||
byte[] bytes = resources.get(name);
|
||||
if (bytes != null) {
|
||||
return bytes;
|
||||
}
|
||||
return super.getClassBytes(name, transformedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getClassBytes(String name, boolean runTransformers) throws ClassNotFoundException, IOException {
|
||||
byte[] bytes = resources.get(name);
|
||||
if (bytes != null) {
|
||||
return bytes;
|
||||
}
|
||||
return super.getClassBytes(name, runTransformers);
|
||||
}
|
||||
}
|
|
@ -6,12 +6,8 @@
|
|||
package dev.baseband.server;
|
||||
|
||||
|
||||
import de.tudbut.net.ws.Server;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
public class Main {
|
||||
/*
|
||||
public static final RSAKey rsaKey = new RSAKey();
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -23,4 +19,6 @@ public class Main {
|
|||
|
||||
while(true);
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue