make it work in dev environments

This commit is contained in:
Daniella / Tove 2023-09-14 21:01:09 +02:00
parent 42685815c2
commit 525a538c42
Signed by: TudbuT
GPG key ID: 7D63D5634B7C417F
5 changed files with 34 additions and 9 deletions

5
.gitignore vendored
View file

@ -3,3 +3,8 @@
/build/
/obf/
/Obf/
.classpath
.project
.settings/
/.idea/

7
Client/.gitignore vendored
View file

@ -39,4 +39,9 @@ bin/
.vscode/
### Mac OS ###
.DS_Store
.DS_Store
run/

View file

@ -8,16 +8,20 @@ import com.baseband.client.module.Module;
import com.baseband.client.module.modules.*;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tudbut.tools.Lock;
import java.util.ArrayList;
@Mod(modid = "baseband")
public class BaseBand {
public static int majorVersion = 1;
public static int buildNumber = 3;
public static String hash = "775f55b8c02f8a4e";
public static int buildNumber = 14;
public static String hash = "40f9263e7e638bf5";
public static String name = "BaseBand";
public long timeOfCompile = 1694681365260L;
@ -27,16 +31,20 @@ public class BaseBand {
public ArrayList<Module> modules = new ArrayList<>();
public static BaseBand INSTANCE;
public static BaseBand INSTANCE; { INSTANCE = this; }
public static BaseBand getInstance() {
if(INSTANCE == null) {
INSTANCE = new BaseBand();
new BaseBand();
}
return INSTANCE;
}
public static final Logger log = LogManager.getLogger("BaseBand");
@Mod.EventHandler
public void eventInit(FMLPreInitializationEvent event) {
onInit();
}
public void onInit() {
Utils.check();

View file

@ -123,7 +123,8 @@ public class GuiBB extends GuiScreen {
resetButtons();
}
// Call onTick on every button
for (Button button : buttons) {
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
if (button != null)
button.onTick(this);
}
@ -175,7 +176,8 @@ public class GuiBB extends GuiScreen {
cy = mouseY;
// Notify buttons
for (Button button : buttons) {
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
if (button != null)
if (button.mouseClicked(mouseX, mouseY, mouseButton))
return;
@ -200,7 +202,8 @@ public class GuiBB extends GuiScreen {
cy = mouseY;
// Notify buttons
for (Button button : buttons) {
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
if (button != null)
button.mouseReleased();
}
@ -227,7 +230,8 @@ public class GuiBB extends GuiScreen {
//}
int m = -Mouse.getDWheel();
if(m != 0) {
for (Button button : buttons) {
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
if (button != null) {
button.y += (lastScrollPos - m) / 3;
}

View file

@ -55,6 +55,9 @@ public class Utils {
//Check if we have the loader
try {
// funny bypass for dev env
if(new File("../../Client").isDirectory())
return;
Class.forName("org.baseband.launcher.Tweaker");
} catch (Exception e) {
crash();