diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-07-09 00:29:49 +0200 |
---|---|---|
committer | hackthetime <l4bg0jb7@duck.com> | 2023-09-05 08:21:34 +0200 |
commit | 0e1630dd2afd2eb2f23d47ab89d646b81744fc9e (patch) | |
tree | 3795d22cb9b08e5196a2e371524620cddd7d49b0 /src/main | |
parent | 6b79a865c1cb7d204d660f863411d2055396e780 (diff) | |
download | BBsentials-0e1630dd2afd2eb2f23d47ab89d646b81744fc9e.tar.gz BBsentials-0e1630dd2afd2eb2f23d47ab89d646b81744fc9e.tar.bz2 BBsentials-0e1630dd2afd2eb2f23d47ab89d646b81744fc9e.zip |
a lot of various things
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/hype/bbsentials/api/FromChatSocket.java | 91 | ||||
-rw-r--r-- | src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java | 1 | ||||
-rw-r--r-- | src/main/resources/modid.mixins.json | 2 |
3 files changed, 3 insertions, 91 deletions
diff --git a/src/main/java/de/hype/bbsentials/api/FromChatSocket.java b/src/main/java/de/hype/bbsentials/api/FromChatSocket.java deleted file mode 100644 index 2af25a6..0000000 --- a/src/main/java/de/hype/bbsentials/api/FromChatSocket.java +++ /dev/null @@ -1,91 +0,0 @@ -package de.hype.bbsentials.api; - -import net.minecraft.client.MinecraftClient; - -import java.io.IOException; -import java.io.PrintWriter; -import java.net.Socket; - -public class FromChatSocket implements Runnable { - private Socket socket; - private Thread thread; - private PrintWriter out; - - // Konstruktor, um den Client-Thread zu starten - public FromChatSocket() { - // Starte den Client-Thread - /*thread = new Thread(this); - thread.start(); - System.out.println("Thread started");*/ - } - - // Implementierung der run() Methode des Runnable-Interfaces - public void run() { - try { - boolean connected = false; - // Endlosschleife, um auf Verbindung zum Server zu warten - while (true) { - try { - // Verbinden zum Server auf Port 8001 - socket = new Socket("localhost", 8001); - connected = true; - } catch (IOException e) { - System.out.println("Waiting for server on port 8001..."); - Thread.sleep(1000); // Warte 1 Sekunde, bevor erneut versucht wird, eine Verbindung aufzubauen - } - } - /*if (socket != null) { - // Erstelle einen BufferedReader, um Daten vom Socket zu lesen - BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); - boolean notNull = true; - // Endlosschleife, um auf eingehende Nachrichten zu warten - while (MinecraftClient.getInstance().isRunning() && socket.isConnected() && notNull) { - - } - - // Schließen des BufferedReader und des Sockets - in.close(); - socket.close(); - }*/ - } catch (Exception e) { - e.printStackTrace(); - } - } - - public boolean isInGame() { - MinecraftClient minecraft = MinecraftClient.getInstance(); - if (minecraft.world != null || minecraft.getNetworkHandler() != null) { - // Das Spiel befindet sich in einer Welt oder auf einem Server - return true; - } else { - // Das Spiel befindet sich im Hauptmenü oder in einem anderen Menü - return false; - } - } -} -/* -* try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - String plOutput = mc.getNetworkHandler().onChat.getChatGUI().getChatComponent(0).getUnformattedText(); - List<String> partyMembers = Arrays.asList(plOutput.split("\\r?\\n")).stream() - .filter(s -> s.startsWith("Party Members:")) - .map(s -> s.substring(16).replaceAll(" ●", "")) - .collect(Collectors.toList()); - - mc.player.networkHandler.sendChatMessage("/p disband"); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - String currentPlayer = String.valueOf(mc.player.getName()); - partyMembers.stream() - .filter(s -> !s.equals(currentPlayer)) - .forEach(s -> { - mc.player.networkHandler.sendChatMessage("/p invite " + s); - try { - Thread.sleep(300); - } catch (InterruptedException e) { - } - });*/
\ No newline at end of file diff --git a/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java b/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java index 7444788..50cbac5 100644 --- a/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java +++ b/src/main/java/de/hype/bbsentials/mixins/SimpleOptionMixin.java @@ -25,6 +25,7 @@ public class SimpleOptionMixin implements ISimpleOption { } else { if (!Objects.equals(this.value, value)) { + System.out.println("used mixin"); this.value = value; this.changeCallback.accept(this.value); } diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/modid.mixins.json index 13719d7..980aedc 100644 --- a/src/main/resources/modid.mixins.json +++ b/src/main/resources/modid.mixins.json @@ -4,6 +4,8 @@ "package": "de.hype.bbsentials.mixins", "compatibilityLevel": "JAVA_8", "mixins": [ + "SimpleOptionMixin", + "ClientCommandSourceMixin" ], "client": [ "SimpleOptionMixin", |