fix dev mode, add @ cmd

This commit is contained in:
Sen 2025-06-13 11:19:29 +02:00
parent 53a4f5f1a8
commit 06517a0d34
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
13 changed files with 238 additions and 395 deletions

View file

@ -38,7 +38,7 @@ application {
mainClass = "client.Client"
tasks.run.get().workingDir = rootProject.file("dev/client")
tasks.run.get().workingDir.mkdirs()
tasks.run.get().systemProperties.put("crash.nodump", "")
tasks.run.get().systemProperties.put("runtime.devmode", "")
}
tasks.shadowJar {

View file

@ -19,6 +19,7 @@ import java.util.ArrayDeque;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
@ -161,7 +162,6 @@ import common.packet.CPacketAction.Action;
import common.potion.Potion;
import common.potion.PotionEffect;
import common.properties.IProperty;
import common.rng.Random;
import common.sound.EventType;
import common.sound.PositionedSound;
import common.util.BlockPos;
@ -2251,8 +2251,6 @@ public class Client implements IThreadListener {
}
public void run(long time) {
Log.SYSTEM.info("Java " + System.getProperty("java.version"));
Log.SYSTEM.info(VERSION + " (Protokoll #" + Util.PROTOCOL + ")");
if(!Window.createWindow(VERSION, System.getProperty("opengl.debug") != null))
System.exit(1);
Log.SYSTEM.info("OpenGL %s", GL11.glGetString(GL11.GL_VERSION));
@ -2736,25 +2734,26 @@ public class Client implements IThreadListener {
}
}
});
this.registerDebug(Keysym.AE, "Programm sofort beenden und server beenden", new DebugRunner() {
public void execute(Keysym key) {
if(Client.this.getNetHandler() != null) {
Client.this.getNetHandler().getConnection().sendPacket(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
try {
Thread.sleep(1000L);
if(Util.DEVMODE)
this.registerDebug(Keysym.AE, "Programm sofort beenden und server beenden", new DebugRunner() {
public void execute(Keysym key) {
if(Client.this.getNetHandler() != null) {
Client.this.getNetHandler().getConnection().sendPacket(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
try {
Thread.sleep(1000L);
}
catch(InterruptedException e) {
}
Client.this.interrupted = true;
}
catch(InterruptedException e) {
}
Client.this.interrupted = true;
}
});
});
}
else {
Client.this.interrupted = true;
}
}
else {
Client.this.interrupted = true;
}
}
});
});
}
private boolean handleDebugKey(Keysym key) {
@ -2774,12 +2773,19 @@ public class Client implements IThreadListener {
public static void main(String[] args) {
long time = System.currentTimeMillis();
Util.checkPlatform();
Thread.currentThread().setName("Render thread");
Locale.setDefault(Locale.ROOT);
Util.setupHandlers();
Log.init();
Log.setSync(CLIENT);
Log.SYSTEM.info("Java " + System.getProperty("java.version"));
Log.SYSTEM.info("Starte " + VERSION + " (Protokoll #" + Util.PROTOCOL + ")");
if(Util.DEVMODE)
Log.SYSTEM.warn("Entwicklungsmodus aktiv - Debugging-Features sind verfügbar");
Window.init();
ModelBlock.setAsProvider();
Registry.setup("Render thread");
Registry.register();
UniverseRegistry.register();
Log.setSync(CLIENT);
CLIENT.run(time);
Window.end();
}
@ -2840,26 +2846,6 @@ public class Client implements IThreadListener {
return data;
}
// plr_play("/home/sen/Musik/midi50k/Video_Games/ff/ff2cecil.mid", 0);
public static void meltdown() {
Random rand = new Random();
Log.SYSTEM.error("CORE_MELTDOWN: Nuclear processor core meltdown imminent\n\n" +
" ************************ CAUTION ************************\n" +
" KCTL: Processor core #%02d has reached a critical\n" +
" temperature, system explosion is imminent! \n" +
" According to the general core density \n" +
" calculation routine defined by the SKC \n" +
" (Hard) Warfare Testing Facility (SKC-WTF) \n" +
" your processor will cause a detonation with \n" +
" a radius of (roughly) %d.%d kilometers. \n" +
" In addition, it will release appoximately \n" +
" %d megajoules of ionizing radiation. \n" +
" You have an estimate time of %d minutes and \n" +
" %d seconds left to clear the detonation area. \n" +
" ************************ CAUTION ************************\n"
, rand.range(1, 64), rand.range(1, 9), rand.range(0, 9), rand.range(10000, 39999), rand.range(3, 9), rand.range(2, 59));
}
public <T extends CVar> T getVar(String name) {
return (T)cvars.get(name);
}