command completion

This commit is contained in:
Sen 2025-03-17 18:21:41 +01:00
parent 0839beb98e
commit a8f6af2b37
11 changed files with 400 additions and 347 deletions

View file

@ -789,8 +789,11 @@ public class Game implements IThreadListener {
entity.getHealth() + TextColor.GRAY + " / " + EntityLiving.getMaxHpColor(entity.getMaxHealth()) +
entity.getMaxHealth() + TextColor.GRAY + "]";
Drawing.drawTextboxCentered(s, x, y, 0x3f000000);
Drawing.drawRectColor(x - 200, y + 20, 400, 10, 0xff000000);
Drawing.drawRectColor(x - 200, y + 20, (int)(400.0f * ((float)entity.getHealth() / (float)entity.getMaxHealth())), 10, 0xff000000 | entity.getColor());
Drawing.drawRect2GradBorder(x - 200, y + 20, 400, 10, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff9f9f9f, 0xff9f9f9f, 0xff6f6f6f);
Drawing.drawGradient(x - 200 + 2, y + 20 + 2, (int)(396.0f * ((float)entity.getHealth() / (float)entity.getMaxHealth())), 6, entity.getColor() | 0xff000000,
Drawing.mixColor(entity.getColor() | 0xff000000, 0xff000000));
// Drawing.drawRectColor(x - 200, y + 20, 400, 10, 0xff000000);
// Drawing.drawRectColor(x - 200, y + 20, , 0xff000000 | );
y += 40;
}
else {
@ -2121,8 +2124,11 @@ public class Game implements IThreadListener {
this.full(!this.fullscreen);
}
if(!(this.open instanceof GuiLoading)) {
if(!(this.open instanceof GuiConsole) && Bind.COMMAND.isPressed()) {
this.displayGuiScreen(GuiConsole.INSTANCE);
if(!(this.open instanceof GuiConsole) && Bind.CONSOLE.isPressed()) {
this.displayGuiScreen(GuiConsole.INSTANCE.setFull(true));
}
else if(this.open == null && Bind.COMMAND.isPressed()) {
this.displayGuiScreen(GuiConsole.INSTANCE.setFull(false));
}
// if(this.theWorld != null && this.open == null && Bind.COMMAND.isPressed()) {
// this.displayGuiScreen(GuiChat.INSTANCE);
@ -2722,6 +2728,10 @@ public class Game implements IThreadListener {
public <T extends CVar> T getVar(String name) {
return (T)cvars.get(name);
}
public Iterable<String> getVars() {
return this.cvars.keySet();
}
public void setDirty() {
cfgDirty = true;
@ -2859,7 +2869,7 @@ public class Game implements IThreadListener {
}
Log.CONSOLE.user(TextColor.GREEN + "CVARs insgesamt registriert: %d", cvars.size());
// this.command(line);
// return;
return;
}
else if(line.startsWith("#")) {
String tok = line.substring(1);
@ -2882,7 +2892,7 @@ public class Game implements IThreadListener {
}
}
if(this.thePlayer != null && this.getNetHandler() != null)
this.getNetHandler().addToSendQueue(new CPacketMessage(CPacketMessage.Type.CHAT, line));
this.getNetHandler().addToSendQueue(new CPacketMessage(line.startsWith("/") ? CPacketMessage.Type.COMMAND : CPacketMessage.Type.CHAT, line.startsWith("/") ? line.substring(1) : line));
// Log.CONSOLE.user("%s", line);
// this.command(line);
}
@ -2900,6 +2910,7 @@ public class Game implements IThreadListener {
public void log(String prefixed, String line) {
String msg = this.conTimestamps ? prefixed : line;
// this.addMessage(msg);
if((buffer.length() + msg.length() + 1) > LOG_BUFFER) {
int offset = (msg.length() + 1) > 1024 ? (msg.length() + 1) : 1024;
int nl = buffer.indexOf('\n', offset);