improve renaming and cheats
This commit is contained in:
parent
4d406a70e1
commit
7e9673dc25
36 changed files with 346 additions and 186 deletions
|
@ -53,6 +53,7 @@ import client.gui.container.GuiContainer;
|
|||
import client.gui.container.GuiInventory;
|
||||
import client.gui.element.Area;
|
||||
import client.gui.ingame.GuiGameOver;
|
||||
import client.gui.ingame.GuiRename;
|
||||
import client.network.ClientLoginHandler;
|
||||
import client.network.ClientPlayer;
|
||||
import client.network.DummyConnection;
|
||||
|
@ -261,6 +262,12 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static class StyleFunction implements EnumFunction<Style> {
|
||||
public void apply(EnumVar cv, Style value) {
|
||||
Client.CLIENT.rescale();
|
||||
}
|
||||
}
|
||||
|
||||
private interface DebugRunner {
|
||||
void execute(Keysym key);
|
||||
}
|
||||
|
@ -470,7 +477,7 @@ public class Client implements IThreadListener {
|
|||
@Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen")
|
||||
public boolean conAutoclose = true;
|
||||
public boolean interrupted;
|
||||
@Variable(name = "gui_theme", category = CVarCategory.GUI, display = "Oberflächen-Design")
|
||||
@Variable(name = "gui_theme", category = CVarCategory.GUI, display = "Design", callback = StyleFunction.class)
|
||||
public Style style = Style.DEFAULT;
|
||||
@Variable(name = "gui_scroll_lines", category = CVarCategory.GUI, min = 1, max = 10, display = "Scrollbreite", unit = "Zeilen")
|
||||
public int scrollLines = 3;
|
||||
|
@ -556,7 +563,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
|
||||
public void displayConnecting(ServerInfo server) {
|
||||
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ..."));
|
||||
this.show(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ..."));
|
||||
}
|
||||
|
||||
public void connect(final ServerInfo server) {
|
||||
|
@ -612,7 +619,7 @@ public class Client implements IThreadListener {
|
|||
WorldClient world = new WorldClient(this, Space.INSTANCE);
|
||||
this.loadWorld(world, EntityRegistry.getEntityID(EntityCpu.class));
|
||||
this.player.setId(0);
|
||||
this.displayGuiScreen(null);
|
||||
this.show(null);
|
||||
this.player.flying = true;
|
||||
this.player.noclip = true;
|
||||
this.player.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1));
|
||||
|
@ -720,6 +727,8 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
if(Bind.THROW.isPressed())
|
||||
this.open.dropItem();
|
||||
else if(Bind.RENAME.isPressed())
|
||||
this.open.renameItem();
|
||||
for(int z = 0; z < this.keyBindsHotbar.length; z++) {
|
||||
if(this.keyBindsHotbar[z].isPressed())
|
||||
this.open.useHotbar(z);
|
||||
|
@ -772,6 +781,11 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
this.player.dropOneItem(this.ctrl());
|
||||
}
|
||||
else if(Bind.RENAME.isPressed()) {
|
||||
ItemStack stack = this.player.getCurrentEquippedItem();
|
||||
if(stack != null)
|
||||
this.show(new GuiRename(-1, stack, null));
|
||||
}
|
||||
|
||||
this.primary |= Bind.PRIMARY.isPressed();
|
||||
this.secondary |= Bind.SECONDARY.isPressed();
|
||||
|
@ -801,7 +815,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
if (this.player.getHealth() <= 0)
|
||||
{
|
||||
this.displayGuiScreen(null);
|
||||
this.show(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1294,7 +1308,7 @@ public class Client implements IThreadListener {
|
|||
// }
|
||||
// }
|
||||
|
||||
public void displayGuiScreen(Gui gui)
|
||||
public void show(Gui gui)
|
||||
{
|
||||
if(!this.refreshing)
|
||||
this.waitingForFile = false;
|
||||
|
@ -1548,7 +1562,7 @@ public class Client implements IThreadListener {
|
|||
|
||||
inventoryplayer.setCurrentItem(item);
|
||||
if(this.itemCheat) {
|
||||
this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), inventoryplayer.currentItem, this.ctrl()));
|
||||
this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), -2 - inventoryplayer.currentItem, this.ctrl()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2110,7 +2124,7 @@ public class Client implements IThreadListener {
|
|||
this.fb_y = Math.max(this.fb_raw_y / this.scale, MIN_HEIGHT);
|
||||
if(this.open != null) {
|
||||
this.refreshing = true;
|
||||
this.displayGuiScreen(this.open);
|
||||
this.show(this.open);
|
||||
this.refreshing = false;
|
||||
}
|
||||
}
|
||||
|
@ -2271,7 +2285,7 @@ public class Client implements IThreadListener {
|
|||
this.sync(this.sync);
|
||||
// this.startSound(true);
|
||||
this.getVar("tic_target").setDefault();
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
this.show(GuiMenu.INSTANCE);
|
||||
Log.SYSTEM.info("Client gestartet in " + String.format("%.1f", (double)(System.currentTimeMillis() - time) / 1000.0) + " Sekunden");
|
||||
|
||||
while(!this.interrupted) {
|
||||
|
@ -2348,7 +2362,7 @@ public class Client implements IThreadListener {
|
|||
public void disconnected(String msg) {
|
||||
Log.NETWORK.info("Getrennt: %s", msg);
|
||||
this.unload(true);
|
||||
this.displayGuiScreen(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg));
|
||||
this.show(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2363,32 +2377,32 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
if(!(this.open instanceof GuiLoading)) {
|
||||
if(!(this.open instanceof GuiConsole) && Bind.CONSOLE.isPressed()) {
|
||||
this.displayGuiScreen(GuiConsole.INSTANCE.setFull(true));
|
||||
this.show(GuiConsole.INSTANCE.setFull(true));
|
||||
}
|
||||
else if(this.open == null && Bind.COMMAND.isPressed()) {
|
||||
this.displayGuiScreen(GuiConsole.INSTANCE.setFull(false));
|
||||
this.show(GuiConsole.INSTANCE.setFull(false));
|
||||
}
|
||||
// if(this.theWorld != null && this.open == null && Bind.COMMAND.isPressed()) {
|
||||
// this.displayGuiScreen(GuiChat.INSTANCE);
|
||||
// }
|
||||
if(this.world != null && Bind.MENU.isPressed()) {
|
||||
if(this.open != (this.charEditor ? GuiChar.INSTANCE : null))
|
||||
this.displayGuiScreen(this.charEditor ? GuiChar.INSTANCE : null);
|
||||
this.show(this.charEditor ? GuiChar.INSTANCE : null);
|
||||
else
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
this.show(GuiMenu.INSTANCE);
|
||||
}
|
||||
else if(this.world == null && !(this.open instanceof GuiMenu) && Bind.MENU.isPressed()) {
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
this.show(GuiMenu.INSTANCE);
|
||||
}
|
||||
if(this.world != null && !this.charEditor && Bind.INVENTORY.isPressed()) {
|
||||
if(this.open instanceof GuiContainer) {
|
||||
this.displayGuiScreen(null);
|
||||
this.show(null);
|
||||
}
|
||||
else if(this.open == null) {
|
||||
if(this.player.isRiding() && this.player.vehicle instanceof EntityHorse)
|
||||
this.player.sendHorseInventory();
|
||||
else
|
||||
this.displayGuiScreen(/* this.itemCheat ? new GuiCheat() : */ new GuiInventory(this.player));
|
||||
this.show(/* this.itemCheat ? new GuiCheat() : */ new GuiInventory(this.player));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2506,7 +2520,7 @@ public class Client implements IThreadListener {
|
|||
if(this.world != null && this.getNetHandler() != null)
|
||||
this.getNetHandler().getConnection().closeChannel("Quitting");
|
||||
this.unloadWorld();
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
this.show(GuiMenu.INSTANCE);
|
||||
}
|
||||
|
||||
private void startSound(boolean load) {
|
||||
|
@ -2552,7 +2566,7 @@ public class Client implements IThreadListener {
|
|||
this.registerDebug(Keysym.H, "Hilfe zu Tastenkombinationen anzeigen", new DebugRunner() {
|
||||
public void execute(Keysym key) {
|
||||
String bind = Bind.CHEAT.getInput() == null ? "n/a" : Bind.CHEAT.getInput().getDisplay();
|
||||
Client.this.displayGuiScreen(new GuiInfo("Hilfe zu Tastenkombinationen", TextColor.DGREEN + "" + Client.this.debug.size() + " Tastenkombinationen stehen zur Verfügung:\n" +
|
||||
Client.this.show(new GuiInfo("Hilfe zu Tastenkombinationen", TextColor.DGREEN + "" + Client.this.debug.size() + " Tastenkombinationen stehen zur Verfügung:\n" +
|
||||
Util.buildLines(new Function<DebugFunction, String>() {
|
||||
public String apply(DebugFunction func) {
|
||||
return TextColor.CYAN + bind + TextColor.RED + "+" + TextColor.GREEN + func.key.getDisplay() + TextColor.GRAY + " - " + TextColor.YELLOW + func.help;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue