commands, camera, messages, overlay, ..
This commit is contained in:
parent
75f91dbf4c
commit
d45cd7ec2c
126 changed files with 854 additions and 628 deletions
|
@ -80,6 +80,7 @@ import game.init.BlockRegistry;
|
|||
import game.init.Config;
|
||||
import game.init.EntityRegistry;
|
||||
import game.init.ItemRegistry;
|
||||
import game.init.Items;
|
||||
import game.init.Registry;
|
||||
import game.init.SoundEvent;
|
||||
import game.inventory.InventoryPlayer;
|
||||
|
@ -87,7 +88,6 @@ import game.item.Item;
|
|||
import game.item.ItemBlock;
|
||||
import game.item.ItemControl;
|
||||
import game.item.ItemStack;
|
||||
import game.log.ConsolePos;
|
||||
import game.log.Log;
|
||||
import game.log.LogLevel;
|
||||
import game.log.Message;
|
||||
|
@ -96,8 +96,8 @@ import game.model.ModelManager;
|
|||
import game.network.IThreadListener;
|
||||
import game.network.NetConnection;
|
||||
import game.network.NetHandler.ThreadQuickExitException;
|
||||
import game.network.NetHandlerLoginClient;
|
||||
import game.network.NetHandlerPlayClient;
|
||||
import game.network.ClientLoginHandler;
|
||||
import game.network.ClientPlayer;
|
||||
import game.network.PlayerController;
|
||||
import game.packet.CPacketAction;
|
||||
import game.packet.CPacketAction.Action;
|
||||
|
@ -201,9 +201,27 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static class ConFunction implements IntFunction {
|
||||
public static class ConsoleFunction implements IntFunction {
|
||||
public void apply(IntVar cv, int value) {
|
||||
Game.getGame().resize(value);
|
||||
Game.getGame().resizeConsole();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ChatFunction implements IntFunction {
|
||||
public void apply(IntVar cv, int value) {
|
||||
Game.getGame().resizeChat();
|
||||
}
|
||||
}
|
||||
|
||||
public static class FeedFunction implements IntFunction {
|
||||
public void apply(IntVar cv, int value) {
|
||||
Game.getGame().resizeFeed();
|
||||
}
|
||||
}
|
||||
|
||||
public static class HotbarFunction implements IntFunction {
|
||||
public void apply(IntVar cv, int value) {
|
||||
Game.getGame().resizeHotbar();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,13 +254,17 @@ public class Game implements IThreadListener {
|
|||
private final Thread clThread = Thread.currentThread();
|
||||
private final Map<String, CVar> cvars = Maps.newTreeMap();
|
||||
private final Map<Keysym, DebugFunction> debug = Maps.newTreeMap();
|
||||
private final List<Message> log = Lists.newArrayList();
|
||||
private final List<Message> console = Lists.newArrayList();
|
||||
private final List<Message> chat = Lists.newArrayList();
|
||||
private final List<Message> feed = Lists.newArrayList();
|
||||
private final List<Message> hotbar = Lists.newArrayList();
|
||||
private final File config = new File(System.getProperty("config.file", "game.cfg"));
|
||||
|
||||
private boolean primary;
|
||||
private boolean secondary;
|
||||
private boolean tertiary;
|
||||
private boolean quarternary;
|
||||
private boolean cameraUsed;
|
||||
public boolean jump;
|
||||
public boolean sneak;
|
||||
public boolean debugCamEnable;
|
||||
|
@ -343,15 +365,21 @@ public class Game implements IThreadListener {
|
|||
public DisplayMode vidMode;
|
||||
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
|
||||
public int dclickDelay = 250;
|
||||
@Variable(name = "con_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ConFunction.class, display = "Nachrichten im Overlay")
|
||||
public int hudSize = 32;
|
||||
@Variable(name = "con_fadeout", category = CVarCategory.CONSOLE, min = 100, max = 60000, display = "Dauer bis zum Ausblenden", unit = "ms")
|
||||
public int hudFadeout = 5000;
|
||||
@Variable(name = "con_overlay", category = CVarCategory.CONSOLE, display = "Konsolen-Overlay")
|
||||
@Variable(name = "console_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ConsoleFunction.class, display = "Nachrichten in der Konsole")
|
||||
public int consoleSize = 32;
|
||||
@Variable(name = "chat_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = ChatFunction.class, display = "Nachrichten im Chat")
|
||||
public int chatSize = 32;
|
||||
@Variable(name = "feed_size", category = CVarCategory.CONSOLE, min = 0, max = 128, callback = FeedFunction.class, display = "Nachrichten im Feed")
|
||||
public int feedSize = 8;
|
||||
@Variable(name = "hotbar_size", category = CVarCategory.CONSOLE, min = 0, max = 16, callback = HotbarFunction.class, display = "Nachrichten in der Hotbar")
|
||||
public int hotbarSize = 2;
|
||||
@Variable(name = "overlay_fadeout", category = CVarCategory.CONSOLE, min = 1, max = 60, display = "Dauer bis zum Ausblenden", unit = "s")
|
||||
public int hudFadeout = 8;
|
||||
@Variable(name = "overlay_enabled", category = CVarCategory.CONSOLE, display = "Nachrichten-Overlay")
|
||||
public boolean hudOverlay = true;
|
||||
@Variable(name = "con_position", category = CVarCategory.CONSOLE, display = "Position des Overlays")
|
||||
public ConsolePos hudPos = ConsolePos.BOTTOM;
|
||||
@Variable(name = "con_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
|
||||
@Variable(name = "chat_permanent", category = CVarCategory.CONSOLE, display = "Nachrichten im Chat immer einblenden")
|
||||
public boolean chatPermanent = false;
|
||||
@Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
|
||||
public int hudOpacity = 0x40;
|
||||
public boolean syncLimited;
|
||||
public boolean vsync;
|
||||
|
@ -426,7 +454,7 @@ public class Game implements IThreadListener {
|
|||
try
|
||||
{
|
||||
connection = NetConnection.createNetworkManagerAndConnect(InetAddress.getByName(IDN.toASCII(address)), port);
|
||||
connection.setNetHandler(new NetHandlerLoginClient(connection, this));
|
||||
connection.setNetHandler(new ClientLoginHandler(connection, this));
|
||||
connection.sendPacket(new HPacketHandshake(Config.PROTOCOL));
|
||||
connection.sendPacket(new LPacketPasswordResponse(user, access, pass));
|
||||
}
|
||||
|
@ -450,14 +478,14 @@ public class Game implements IThreadListener {
|
|||
// this.displayGuiScreen(null);
|
||||
SocketAddress socket = server.setLocalEndpoint();
|
||||
NetConnection connection = NetConnection.provideLocalClient(socket);
|
||||
connection.setNetHandler(new NetHandlerLoginClient(connection, this));
|
||||
connection.setNetHandler(new ClientLoginHandler(connection, this));
|
||||
connection.sendPacket(new HPacketHandshake(Config.PROTOCOL));
|
||||
connection.sendPacket(new LPacketPasswordResponse(user, "", ""));
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
public void unloadWorld() {
|
||||
NetHandlerPlayClient netHandler = this.getNetHandler();
|
||||
ClientPlayer netHandler = this.getNetHandler();
|
||||
if(netHandler != null)
|
||||
netHandler.cleanup();
|
||||
this.debugWorld = false;
|
||||
|
@ -958,8 +986,12 @@ public class Game implements IThreadListener {
|
|||
Drawing.drawScaled(this, Gui.DIRT_BACKGROUND);
|
||||
if(Bind.INFO.isDown() && (this.open == null || !(this.open.selected instanceof Textbox)))
|
||||
this.drawInfo();
|
||||
if(this.hudOverlay && !(this.open instanceof GuiConsole))
|
||||
this.drawOverlay();
|
||||
if(this.hudOverlay && !(this.open instanceof GuiConsole)) {
|
||||
this.drawOverlay(this.feed, this.feedSize, false, 1, 0, 0);
|
||||
this.drawOverlay(this.console, this.consoleSize, true, 1, 0, this.fb_y);
|
||||
this.drawOverlay(this.hotbar, this.hotbarSize, true, 0, this.fb_x / 2, this.fb_y - 120);
|
||||
this.drawOverlay(this.chat, this.chatSize, true, -1, this.fb_x, this.fb_y);
|
||||
}
|
||||
if(this.drawFps) { // && !(this.open instanceof GuiConsole)
|
||||
if(this.drawDebug && this.open == null) {
|
||||
this.renderStats();
|
||||
|
@ -1047,6 +1079,11 @@ public class Game implements IThreadListener {
|
|||
this.screenshot = false;
|
||||
screenshot();
|
||||
}
|
||||
if(this.cameraUsed) {
|
||||
this.cameraUsed = false;
|
||||
if(this.theWorld != null)
|
||||
this.theWorld.setLastLightning(1, 0xffffff);
|
||||
}
|
||||
if(this.isDirty())
|
||||
this.save();
|
||||
Thread.yield();
|
||||
|
@ -1239,10 +1276,10 @@ public class Game implements IThreadListener {
|
|||
boolean flag = true;
|
||||
ItemStack itemstack = this.thePlayer.inventory.getCurrentItem();
|
||||
|
||||
// if (itemstack != null && itemstack.getItem() == Items.camera)
|
||||
// {
|
||||
// this.makeScreenshot();
|
||||
// }
|
||||
if (itemstack != null && itemstack.getItem() == Items.camera && !this.saving)
|
||||
{
|
||||
this.screenshot = this.cameraUsed = true;
|
||||
}
|
||||
|
||||
if (this.pointed == null)
|
||||
{
|
||||
|
@ -1449,7 +1486,7 @@ public class Game implements IThreadListener {
|
|||
// }
|
||||
}
|
||||
|
||||
public NetHandlerPlayClient getNetHandler()
|
||||
public ClientPlayer getNetHandler()
|
||||
{
|
||||
return this.thePlayer != null ? this.thePlayer.sendQueue : null;
|
||||
}
|
||||
|
@ -1809,6 +1846,10 @@ public class Game implements IThreadListener {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean canRenderHud() {
|
||||
return (this.showHud || this.open != null) && !this.cameraUsed;
|
||||
}
|
||||
|
||||
public boolean shift() {
|
||||
return Bind.isWindowActive() && (Keysym.LEFT_SHIFT.read() || Keysym.RIGHT_SHIFT.read());
|
||||
}
|
||||
|
@ -2109,7 +2150,8 @@ public class Game implements IThreadListener {
|
|||
PerfSection.RENDER.enter();
|
||||
this.render();
|
||||
PerfSection.GUI.enter();
|
||||
this.renderHud();
|
||||
if(this.canRenderHud())
|
||||
this.renderHud();
|
||||
PerfSection.REST.enter();
|
||||
this.finish();
|
||||
PerfSection.SWAP.enter();
|
||||
|
@ -2259,7 +2301,7 @@ public class Game implements IThreadListener {
|
|||
Game.this.schedule(new Runnable() {
|
||||
public void run() {
|
||||
Game.this.saving = false;
|
||||
Log.SYSTEM.user("Bildschirmfoto als '%s' gespeichert", saved.getName());
|
||||
Game.this.logFeed("Bildschirmfoto als '%s' gespeichert", saved.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2372,12 +2414,12 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
public void restartSound(boolean load) {
|
||||
Log.CONSOLE.user("Lade Sound-System neu");
|
||||
Game.this.logFeed("Lade Sound-System neu");
|
||||
this.soundManager.unload();
|
||||
if(audio.end())
|
||||
Log.SOUND.info("Audiogerät geschlossen");
|
||||
this.startSound(load);
|
||||
Log.CONSOLE.user("Das Sound-System wurde neu geladen");
|
||||
Game.this.logFeed("Das Sound-System wurde neu geladen");
|
||||
}
|
||||
|
||||
public AudioInterface getAudioInterface() {
|
||||
|
@ -2444,74 +2486,74 @@ public class Game implements IThreadListener {
|
|||
});
|
||||
this.registerDebug(Keysym.E, "Gegenstands-Cheat-Menü umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Cheat-Menü: %s", (Game.this.itemCheat ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Cheat-Menü: %s", (Game.this.itemCheat ^= true) ? "an" : "aus");
|
||||
if(Game.this.open instanceof GuiContainer)
|
||||
Game.this.open.init();
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.L, "Maximale Helligkeit umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Maximale Helligkeit: %s", (Game.this.setGamma ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Maximale Helligkeit: %s", (Game.this.setGamma ^= true) ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.J, "JVM GC ausführen", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Führe JVM GC aus");
|
||||
Game.this.logFeed("Führe JVM GC aus");
|
||||
long mem = Runtime.getRuntime().freeMemory();
|
||||
System.gc();
|
||||
System.gc();
|
||||
mem = Runtime.getRuntime().freeMemory() - mem;
|
||||
mem = mem < 0L ? 0L : mem;
|
||||
Log.CONSOLE.user("JVM GC ausgeführt: %d MB freigegeben", (int)(mem / 1024L / 1024L));
|
||||
Game.this.logFeed("JVM GC ausgeführt: %d MB freigegeben", (int)(mem / 1024L / 1024L));
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.B, "Hitbox-Overlay umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Game.this.getRenderManager().setDebugBoundingBox(!Game.this.getRenderManager().isDebugBoundingBox());
|
||||
Log.CONSOLE.user("Objekt-Grenzen: %s", Game.this.getRenderManager().isDebugBoundingBox() ? "an" : "aus");
|
||||
Game.this.logFeed("Objekt-Grenzen: %s", Game.this.getRenderManager().isDebugBoundingBox() ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.K, "Debug-Kamera in 3. Person umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Debug-Kamera 3. Person: %s", (Game.this.debugCamEnable ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Debug-Kamera 3. Person: %s", (Game.this.debugCamEnable ^= true) ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.X, "Röntgenblick umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Game.this.xrayActive ^= true;
|
||||
Game.this.renderGlobal.loadRenderers();
|
||||
Log.CONSOLE.user("Röntgenblick: %s", Game.this.xrayActive ? "an" : "aus");
|
||||
Game.this.logFeed("Röntgenblick: %s", Game.this.xrayActive ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.O, "Objekt-Overlay umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Objekt-Umrahmung: %s", (Game.this.renderOutlines ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Objekt-Umrahmung: %s", (Game.this.renderOutlines ^= true) ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.I, "Block-Objekt-Overlay umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Block-Objekte anzeigen: %s", (Game.this.tileOverlay ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Block-Objekte anzeigen: %s", (Game.this.tileOverlay ^= true) ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.Y, "Alle Chunks neu kompilieren", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Kompiliere alle Chunks neu");
|
||||
Game.this.logFeed("Kompiliere alle Chunks neu");
|
||||
Game.this.renderGlobal.loadRenderers();
|
||||
Log.CONSOLE.user("Alle Chunks wurden neu kompiliert");
|
||||
Game.this.logFeed("Alle Chunks wurden neu kompiliert");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.T, "Alle Texturen neu laden", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Lade Texturen neu");
|
||||
Game.this.logFeed("Lade Texturen neu");
|
||||
Game.this.refreshResources();
|
||||
Log.CONSOLE.user("Texturen wurden neu geladen");
|
||||
Game.this.logFeed("Texturen wurden neu geladen");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.S, "Alle Sounds neu laden", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Lade Sounds neu");
|
||||
Game.this.logFeed("Lade Sounds neu");
|
||||
Game.this.restartSound(true);
|
||||
Log.CONSOLE.user("Sounds wurden neu geladen");
|
||||
Game.this.logFeed("Sounds wurden neu geladen");
|
||||
}
|
||||
});
|
||||
this.registerDebug(Keysym.W, "Server-Tick-Limit umschalten (Welt beschleunigen / Warpmodus)", new DebugRunner() {
|
||||
|
@ -2549,7 +2591,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
else {
|
||||
this.lastUsed = System.currentTimeMillis();
|
||||
Log.CONSOLE.warn("VORSICHT: Debug-Absturz nach mehrmaligem Drücken innerhalb einer Sekunde");
|
||||
Game.this.logFeed(TextColor.RED + "VORSICHT: Debug-Absturz nach mehrmaligem Drücken innerhalb einer Sekunde");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2583,7 +2625,7 @@ public class Game implements IThreadListener {
|
|||
});
|
||||
this.registerDebug(Keysym.UE, "Spieler in Overlay umschalten", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
Log.CONSOLE.user("Spieler-Info in Overlay: %s", (Game.this.debugPlayer ^= true) ? "an" : "aus");
|
||||
Game.this.logFeed("Spieler-Info in Overlay: %s", (Game.this.debugPlayer ^= true) ? "an" : "aus");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2938,7 +2980,7 @@ public class Game implements IThreadListener {
|
|||
|
||||
private void printVar(CVar cv) {
|
||||
String values = cv.getValues();
|
||||
Log.CONSOLE.user("%s " + TextColor.NEON + "%s " + TextColor.DGRAY + "[%s" + TextColor.DGRAY + "]" + TextColor.GRAY + " = " + TextColor.WHITE + "%s " + TextColor.DGRAY +
|
||||
this.logConsole("%s " + TextColor.NEON + "%s " + TextColor.DGRAY + "[%s" + TextColor.DGRAY + "]" + TextColor.GRAY + " = " + TextColor.WHITE + "%s " + TextColor.DGRAY +
|
||||
"[" + TextColor.GRAY + "D " + TextColor.CRIMSON + "%s" + TextColor.DGRAY + "]%s", cv.getType(), cv.getCVarName(), cv.getCategory(), cv.format(), cv.getDefault(),
|
||||
values != null ? " [" + TextColor.LGRAY + values + TextColor.DGRAY + "]" : "");
|
||||
}
|
||||
|
@ -2948,7 +2990,7 @@ public class Game implements IThreadListener {
|
|||
for(CVar cv : cvars.values()) {
|
||||
printVar(cv);
|
||||
}
|
||||
Log.CONSOLE.user(TextColor.GREEN + "CVARs insgesamt registriert: %d", cvars.size());
|
||||
this.logConsole(TextColor.GREEN + "CVARs insgesamt registriert: %d", cvars.size());
|
||||
// this.command(line);
|
||||
return;
|
||||
}
|
||||
|
@ -2958,16 +3000,16 @@ public class Game implements IThreadListener {
|
|||
CVar cv = getVar(space >= 0 ? tok.substring(0, space) : tok);
|
||||
if(cv != null) {
|
||||
if(space < 0 || space >= tok.trim().length()) {
|
||||
Log.CONSOLE.user("%s = %s", cv.getCVarName(), cv.format());
|
||||
this.logConsole("%s = %s", cv.getCVarName(), cv.format());
|
||||
return;
|
||||
}
|
||||
String value = tok.substring(space + 1).trim();
|
||||
if(cv.parse(value)) {
|
||||
cfgDirty = true;
|
||||
Log.CONSOLE.user("%s -> %s", cv.getCVarName(), cv.format());
|
||||
this.logConsole("%s -> %s", cv.getCVarName(), cv.format());
|
||||
}
|
||||
else {
|
||||
Log.CONSOLE.error("Kann CVAR '%s' nicht auf '%s' setzen", cv.getCVarName(), value);
|
||||
this.logConsole(TextColor.RED + "Kann CVAR '%s' nicht auf '%s' setzen", cv.getCVarName(), value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2979,16 +3021,35 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
buffer = TextColor.NEON + "*** " + Config.VERSION + " ***";
|
||||
log.clear();
|
||||
this.buffer = TextColor.NEON + "*** " + Config.VERSION + " ***";
|
||||
this.console.clear();
|
||||
this.chat.clear();
|
||||
this.feed.clear();
|
||||
this.hotbar.clear();
|
||||
}
|
||||
|
||||
public void resize(int size) {
|
||||
while(log.size() > this.hudSize) {
|
||||
private void resize(List<Message> log, int size) {
|
||||
while(log.size() > size) {
|
||||
log.remove(log.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void resizeConsole() {
|
||||
this.resize(this.console, this.consoleSize);
|
||||
}
|
||||
|
||||
public void resizeChat() {
|
||||
this.resize(this.chat, this.chatSize);
|
||||
}
|
||||
|
||||
public void resizeFeed() {
|
||||
this.resize(this.feed, this.feedSize);
|
||||
}
|
||||
|
||||
public void resizeHotbar() {
|
||||
this.resize(this.hotbar, this.hotbarSize);
|
||||
}
|
||||
|
||||
public void log(String prefixed, String line) {
|
||||
String msg = this.conTimestamps ? prefixed : line;
|
||||
// this.addMessage(msg);
|
||||
|
@ -3001,24 +3062,68 @@ public class Game implements IThreadListener {
|
|||
if(this.open instanceof GuiConsole) {
|
||||
((GuiConsole)this.open).setLog(buffer);
|
||||
}
|
||||
if(this.hudSize > 0) {
|
||||
Message lmsg = new Message(line, Timing.tmr_current);
|
||||
while(log.size() >= this.hudSize) {
|
||||
log.remove(log.size() - 1);
|
||||
}
|
||||
|
||||
private void addMessage(List<Message> log, int size, String msg) {
|
||||
Log.CONSOLE.user(msg);
|
||||
if(size > 0) {
|
||||
for(String line : msg.split("\n")) {
|
||||
Message lmsg = new Message(line, Timing.tmr_current);
|
||||
while(log.size() >= size) {
|
||||
log.remove(log.size() - 1);
|
||||
}
|
||||
log.add(0, lmsg);
|
||||
}
|
||||
log.add(0, lmsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void logConsole(String line) {
|
||||
this.addMessage(this.console, this.consoleSize, line);
|
||||
}
|
||||
|
||||
public void logConsole(String fmt, Object ... args) {
|
||||
this.logConsole(String.format(fmt, args));
|
||||
}
|
||||
|
||||
public void logChat(String line) {
|
||||
this.addMessage(this.chat, this.chatSize, line);
|
||||
}
|
||||
|
||||
public void logChat(String fmt, Object ... args) {
|
||||
this.logChat(String.format(fmt, args));
|
||||
}
|
||||
|
||||
public void logFeed(String line) {
|
||||
this.addMessage(this.feed, this.feedSize, line);
|
||||
}
|
||||
|
||||
public void logFeed(String fmt, Object ... args) {
|
||||
this.logFeed(String.format(fmt, args));
|
||||
}
|
||||
|
||||
public void logHotbar(String line) {
|
||||
this.addMessage(this.hotbar, this.hotbarSize, line);
|
||||
}
|
||||
|
||||
public void logHotbar(String fmt, Object ... args) {
|
||||
this.logHotbar(String.format(fmt, args));
|
||||
}
|
||||
|
||||
public void drawOverlay() {
|
||||
if(this.hudSize > 0) {
|
||||
long fade = 1000L * (long)this.hudFadeout;
|
||||
int y = this.hudPos == ConsolePos.BOTTOM ? this.fb_y - Font.YGLYPH : 0;
|
||||
private void drawOverlay(List<Message> log, int size, boolean up, int align, int x, int y) {
|
||||
if(size > 0) {
|
||||
long fade = 1000000L * (long)this.hudFadeout;
|
||||
int bg = (this.hudOpacity << 24) | 0x000000;
|
||||
y = up ? y - Font.YGLYPH : y;
|
||||
for(Iterator<Message> iter = log.iterator(); iter.hasNext();) {
|
||||
Message msg = iter.next();
|
||||
if((Timing.tmr_current - msg.time) <= fade) {
|
||||
Drawing.drawTextbox(msg.message, 0, y, (this.hudOpacity << 24) | 0x000000);
|
||||
y += this.hudPos == ConsolePos.BOTTOM ? -(Font.YGLYPH) : Font.YGLYPH;
|
||||
if((Timing.tmr_current - msg.time) <= fade || (log == this.chat && this.chatPermanent)) {
|
||||
if(align > 0)
|
||||
Drawing.drawTextbox(msg.message, x, y, bg);
|
||||
else if(align < 0)
|
||||
Drawing.drawTextboxRight(msg.message, x, y, bg);
|
||||
else
|
||||
Drawing.drawTextboxCentered(msg.message, x, y, bg);
|
||||
y += up ? -(Font.YGLYPH) : Font.YGLYPH;
|
||||
}
|
||||
else {
|
||||
iter.remove();
|
||||
|
@ -3088,7 +3193,7 @@ public class Game implements IThreadListener {
|
|||
*/
|
||||
|
||||
public void drawInfo() {
|
||||
NetHandlerPlayClient netHandler = this.getNetHandler();
|
||||
ClientPlayer netHandler = this.getNetHandler();
|
||||
if(netHandler != null) {
|
||||
Set<Entry<String, Integer>> list = netHandler.getPlayerList();
|
||||
int size = list.size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue