diff --git a/ChangeLog.txt b/ChangeLog.txt index 8d870aff8..38d2ca3cf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,22 @@ +Minicraft+ version 2.2.0 + ++ Added quests and tutorial ++ Added obsidian knight as the second boss ++ Added limitation to inventories ++ Added limitation to stackable items ++ Added 4 new debug arguments ++ Added a toggle for HUD display ++ Added a toggle for simplified effect display ++ Added a new menu for creative mode ++ Added a few creative mode only items for tile placement +* Changed the display of world edit +* Changed the structure of resource pack +* Split the images of textures +* Changed the UI of crash popup +* Changed a better logging +* Fixed seed random problem +* Improved the localization support + Minicraft+ version 2.1.0 + Added achievements diff --git a/build.gradle b/build.gradle index a6fef3fbe..4c0caf578 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,6 @@ mainClassName = 'minicraft.core.Game' repositories { mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://jitpack.io" } } dependencies { @@ -29,11 +27,6 @@ dependencies { implementation 'com.konghq:unirest-java:3.13.10' implementation 'org.tinylog:tinylog-api:2.4.1' implementation 'org.tinylog:tinylog-impl:2.4.1' - implementation 'com.badlogicgames.gdx:gdx:1.11.0' - implementation 'com.badlogicgames.gdx:gdx-box2d:1.11.0' - implementation 'com.badlogicgames.gdx:gdx-controllers:1.9.13' - implementation 'uk.co.electronstudio.sdl2gdx:sdl2gdx:1.0.4' - implementation 'com.github.WilliamAHartman:Jamepad:1.4.0' } java { diff --git a/src/main/java/minicraft/core/Game.java b/src/main/java/minicraft/core/Game.java index fd6227a76..0268a3db1 100644 --- a/src/main/java/minicraft/core/Game.java +++ b/src/main/java/minicraft/core/Game.java @@ -26,7 +26,6 @@ protected Game() {} // Can't instantiate the Game class. public static final Version VERSION = new Version("2.2.0-dev1"); public static InputHandler input; // Input used in Game, Player, and just about all the *Menu classes. - public static final ControllerHandler controlInput = new ControllerHandler(); // controlInput used in Menu Classes for Controllers public static Player player; public static List notifications = new ArrayList<>(); diff --git a/src/main/java/minicraft/core/Initializer.java b/src/main/java/minicraft/core/Initializer.java index 7919bc271..5124cde5d 100644 --- a/src/main/java/minicraft/core/Initializer.java +++ b/src/main/java/minicraft/core/Initializer.java @@ -16,7 +16,6 @@ import minicraft.util.Logging; import minicraft.util.TinylogLoggingProvider; -import org.tinylog.Logger; import org.tinylog.provider.ProviderRegistry; public class Initializer extends Game { diff --git a/src/main/java/minicraft/core/Updater.java b/src/main/java/minicraft/core/Updater.java index 49d73620d..c1605e88c 100644 --- a/src/main/java/minicraft/core/Updater.java +++ b/src/main/java/minicraft/core/Updater.java @@ -195,7 +195,7 @@ public static void tick() { Tile.tickCount++; } - if (display == null && input.getKey("toggleDebug").clicked) { // Shows debug info in upper-left + if (display == null && input.getKey("F3").clicked) { // Shows debug info in upper-left Renderer.showDebugInfo = !Renderer.showDebugInfo; } diff --git a/src/main/java/minicraft/core/io/ControllerHandler.java b/src/main/java/minicraft/core/io/ControllerHandler.java deleted file mode 100644 index a4aa180be..000000000 --- a/src/main/java/minicraft/core/io/ControllerHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -package minicraft.core.io; - -import com.studiohartman.jamepad.ControllerButton; -import com.studiohartman.jamepad.ControllerIndex; -import com.studiohartman.jamepad.ControllerManager; -import com.studiohartman.jamepad.ControllerUnpluggedException; -import minicraft.util.Logging; - -import java.util.HashMap; - -public class ControllerHandler extends ControllerManager { - private final ControllerIndex controllerIndex; - - public ControllerHandler() { - ControllerManager controllerManager = new ControllerManager(); - controllerManager.initSDLGamepad(); - controllerIndex = controllerManager.getControllerIndex(0); - controllerManager.update(); - try { - Logging.CONTROLLER.debug("Controller Detected: " + controllerManager.getControllerIndex(0).getName()); - } catch (ControllerUnpluggedException e) { - Logging.CONTROLLER.debug("No Controllers Detected, moving on."); - } - - initButtonMap(); - } - - private final HashMap buttonMap = new HashMap<>(); - private void initButtonMap() { - buttonMap.put("MOVE-UP", ControllerButton.DPAD_UP); - buttonMap.put("MOVE-DOWN", ControllerButton.DPAD_DOWN); - buttonMap.put("MOVE-LEFT", ControllerButton.DPAD_LEFT); - buttonMap.put("MOVE-RIGHT", ControllerButton.DPAD_RIGHT); - - buttonMap.put("CURSOR-UP", ControllerButton.DPAD_UP); - buttonMap.put("CURSOR-DOWN", ControllerButton.DPAD_DOWN); - buttonMap.put("CURSOR-LEFT", ControllerButton.DPAD_LEFT); - buttonMap.put("CURSOR-RIGHT", ControllerButton.DPAD_RIGHT); - - buttonMap.put("SELECT", ControllerButton.A); - buttonMap.put("EXIT", ControllerButton.B); - - buttonMap.put("ATTACK", ControllerButton.A); - buttonMap.put("MENU", ControllerButton.X); - buttonMap.put("CRAFT", ControllerButton.Y); - buttonMap.put("PICKUP", ControllerButton.LEFTBUMPER); - - buttonMap.put("PAUSE", ControllerButton.START); - - buttonMap.put("DROP-ONE", ControllerButton.RIGHTBUMPER); - buttonMap.put("DROP-STACK", ControllerButton.RIGHTSTICK); - } - - public boolean buttonPressed(ControllerButton button) { - try { - return controllerIndex.isButtonJustPressed(button); - } catch (ControllerUnpluggedException e) { - return false; - } - } - - public boolean buttonDown(ControllerButton button) { - try { - return controllerIndex.isButtonPressed(button); - } catch (ControllerUnpluggedException e){ - return false; - } - } - - public boolean isKeyPressed(String key) { - return buttonPressed(buttonMap.get(key.toUpperCase())); - } - - public boolean isKeyDown(String key) { - return buttonDown(buttonMap.get(key.toUpperCase())); - } -} diff --git a/src/main/java/minicraft/core/io/InputHandler.java b/src/main/java/minicraft/core/io/InputHandler.java index 0873569ee..10490cc25 100644 --- a/src/main/java/minicraft/core/io/InputHandler.java +++ b/src/main/java/minicraft/core/io/InputHandler.java @@ -131,7 +131,6 @@ private void initKeyMap() { keymap.put("SIMPPOTIONEFFECTS", "O"); // Whether to simplify the potion effect display keymap.put("TOGGLEHUD", "F1"); // Whether to hide hide GUI keymap.put("EXPANDQUESTDISPLAY", "L"); // Expands the quest display - keymap.put("TOGGLEDEBUG", "F3"); // Toggle fps display keymap.put("INFO", "SHIFT-I"); // Toggle player stats display keymap.put("FULLSCREEN", "F11"); @@ -152,24 +151,6 @@ public void tick() { } } - /** - * Check if key has been clicked. - * @param key The key to check. - * @return If it has been clicked. - */ - public boolean isClicked(String key) { - return Game.controlInput.isKeyPressed(key) || getKey(key).clicked; - } - - /** - * Check if key is being held down. - * @param key The key being held down. - * @return If the key is being held down. - */ - public boolean isHeld(String key) { - return Game.controlInput.isKeyDown(key) || getKey(key).down; - } - // The Key class. public class Key { // presses = how many times the Key has been pressed. diff --git a/src/main/java/minicraft/entity/mob/Player.java b/src/main/java/minicraft/entity/mob/Player.java index 1d349e13a..6b4219d41 100644 --- a/src/main/java/minicraft/entity/mob/Player.java +++ b/src/main/java/minicraft/entity/mob/Player.java @@ -218,20 +218,20 @@ public void tick() { if (cooldowninfo > 0) cooldowninfo--; if (questExpanding > 0) questExpanding--; - if (input.getKey("potionEffects").clicked && cooldowninfo == 0) { + if (input.getKey("potionEffects").down && cooldowninfo == 0) { cooldowninfo = 10; showpotioneffects = !showpotioneffects; } - if (input.getKey("simpPotionEffects").clicked) { + if (input.getKey("simpPotionEffects").down) { simpPotionEffects = !simpPotionEffects; } - if (input.getKey("toggleHUD").clicked) { + if (input.getKey("toggleHUD").down) { renderGUI = !renderGUI; } - if (input.getKey("expandQuestDisplay").clicked) { + if (input.getKey("expandQuestDisplay").down) { questExpanding = 30; } @@ -359,10 +359,10 @@ public void tick() { // Move while we are not falling. if (onFallDelay <= 0) { // controlInput.buttonPressed is used because otherwise the player will move one even if held down. - if (input.isHeld("move-up")) vec.y--; - if (input.isHeld("move-down")) vec.y++; - if (input.isHeld("move-left")) vec.x--; - if (input.isHeld("move-right")) vec.x++; + if (input.getKey("move-up").down) vec.y--; + if (input.getKey("move-down").down) vec.y++; + if (input.getKey("move-left").down) vec.x--; + if (input.getKey("move-right").down) vec.x++; } @@ -387,10 +387,10 @@ public void tick() { else directHurt(1, Direction.NONE); // If no stamina, take damage. } - if (activeItem != null && (input.isClicked("drop-one") || input.isClicked("drop-stack"))) { + if (activeItem != null && (input.getKey("drop-one").clicked || input.getKey("drop-stack").clicked)) { Item drop = activeItem.clone(); - if (input.isClicked("drop-one") && drop instanceof StackableItem && ((StackableItem)drop).count > 1) { + if (input.getKey("drop-one").clicked && drop instanceof StackableItem && ((StackableItem)drop).count > 1) { // Drop one from stack ((StackableItem)activeItem).count--; ((StackableItem)drop).count = 1; @@ -401,14 +401,14 @@ public void tick() { level.dropItem(x, y, drop); } - if ((activeItem == null || !activeItem.used_pending) && (input.isClicked("attack")) && stamina != 0 && onFallDelay <= 0) { // This only allows attacks when such action is possible. + if ((activeItem == null || !activeItem.used_pending) && (input.getKey("attack").clicked) && stamina != 0 && onFallDelay <= 0) { // This only allows attacks when such action is possible. if (!potioneffects.containsKey(PotionType.Energy)) stamina--; staminaRecharge = 0; attack(); } - if (input.isClicked("menu") && activeItem != null) { + if (input.getKey("menu").clicked && activeItem != null) { int returned = inventory.add(0, activeItem); if (activeItem instanceof StackableItem) { StackableItem stackable = (StackableItem)activeItem; @@ -427,28 +427,28 @@ public void tick() { } if (Game.getDisplay() == null) { - if (input.isClicked("menu") && !use()) // !use() = no furniture in front of the player; this prevents player inventory from opening (will open furniture inventory instead) + if (input.getKey("menu").clicked && !use()) // !use() = no furniture in front of the player; this prevents player inventory from opening (will open furniture inventory instead) Game.setDisplay(new PlayerInvDisplay(this)); - if (input.isClicked("pause")) + if (input.getKey("pause").clicked) Game.setDisplay(new PauseDisplay()); - if (input.isClicked("craft") && !use()) + if (input.getKey("craft").clicked && !use()) Game.setDisplay(new CraftingDisplay(Recipes.craftRecipes, "minicraft.displays.crafting", this, true)); - if (input.getKey("info").clicked) Game.setDisplay(new InfoDisplay()); + if (input.getKey("info").down) Game.setDisplay(new InfoDisplay()); - if (input.getKey("quicksave").clicked && !Updater.saving) { + if (input.getKey("quicksave").down && !Updater.saving) { Updater.saving = true; LoadingDisplay.setPercentage(0); new Save(WorldSelectDisplay.getWorldName()); } //debug feature: - if (Game.debug && input.getKey("shift-p").clicked) { // Remove all potion effects + if (Game.debug && input.getKey("shift-p").down) { // Remove all potion effects for (PotionType potionType : potioneffects.keySet()) { PotionItem.applyPotion(this, potionType, false); } } - if (input.isClicked("pickup") && (activeItem == null || !activeItem.used_pending)) { + if (input.getKey("pickup").clicked && (activeItem == null || !activeItem.used_pending)) { if (!(activeItem instanceof PowerGloveItem)) { // If you are not already holding a power glove (aka in the middle of a separate interaction)... prevItem = activeItem; // Then save the current item... activeItem = new PowerGloveItem(); // and replace it with a power glove. diff --git a/src/main/java/minicraft/level/tile/Tiles.java b/src/main/java/minicraft/level/tile/Tiles.java index f7592553a..1be200bfc 100644 --- a/src/main/java/minicraft/level/tile/Tiles.java +++ b/src/main/java/minicraft/level/tile/Tiles.java @@ -9,8 +9,6 @@ import minicraft.level.tile.farming.WheatTile; import minicraft.util.Logging; -import org.tinylog.Logger; - public final class Tiles { /// Idea: to save tile names while saving space, I could encode the names in base 64 in the save file...^M /// Then, maybe, I would just replace the id numbers with id names, make them all private, and then make a get(String) method, parameter is tile name. diff --git a/src/main/java/minicraft/network/Network.java b/src/main/java/minicraft/network/Network.java index b1335d909..7a0ada2bf 100644 --- a/src/main/java/minicraft/network/Network.java +++ b/src/main/java/minicraft/network/Network.java @@ -17,7 +17,6 @@ import minicraft.util.Logging; import org.json.JSONObject; -import org.tinylog.Logger; public class Network extends Game { private Network() {} diff --git a/src/main/java/minicraft/saveload/Load.java b/src/main/java/minicraft/saveload/Load.java index 1906c8ceb..753989f79 100644 --- a/src/main/java/minicraft/saveload/Load.java +++ b/src/main/java/minicraft/saveload/Load.java @@ -205,6 +205,8 @@ private void loadGame(String filename) { if (worldVer.compareTo(new Version("2.2.0-dev1")) >= 0) World.setWorldSeed(Long.parseLong(data.remove(0))); + else + World.setWorldSeed(0); if (worldVer.compareTo(new Version("2.0.4-dev8")) >= 0) loadMode(data.remove(0)); diff --git a/src/main/java/minicraft/screen/BookDisplay.java b/src/main/java/minicraft/screen/BookDisplay.java index 8639a10d1..d6f6c445f 100644 --- a/src/main/java/minicraft/screen/BookDisplay.java +++ b/src/main/java/minicraft/screen/BookDisplay.java @@ -84,8 +84,8 @@ private void turnPage(int dir) { @Override public void tick(InputHandler input) { - if (input.isClicked("menu") || input.isClicked("exit")) Game.exitDisplay(); // Close the menu. - if (input.isClicked("cursor-left")) turnPage(-1); // This is what turns the page back - if (input.isClicked("cursor-right")) turnPage(1); // This is what turns the page forward + if (input.getKey("menu").clicked || input.getKey("exit").clicked) Game.exitDisplay(); // Close the menu. + if (input.getKey("cursor-left").clicked) turnPage(-1); // This is what turns the page back + if (input.getKey("cursor-right").clicked) turnPage(1); // This is what turns the page forward } } diff --git a/src/main/java/minicraft/screen/ContainerDisplay.java b/src/main/java/minicraft/screen/ContainerDisplay.java index 34819b037..8b614e823 100644 --- a/src/main/java/minicraft/screen/ContainerDisplay.java +++ b/src/main/java/minicraft/screen/ContainerDisplay.java @@ -46,7 +46,7 @@ protected void onSelectionChange(int oldSel, int newSel) { public void tick(InputHandler input) { super.tick(input); - if(input.isClicked("menu") || chest.isRemoved()) { + if(input.getKey("menu").clicked || chest.isRemoved()) { Game.setDisplay(null); return; } @@ -54,7 +54,7 @@ public void tick(InputHandler input) { Menu curMenu = menus[selection]; int otherIdx = getOtherIdx(); - if((input.isClicked("attack")) || input.getKey("shift-enter").clicked) { + if((input.getKey("attack").clicked) || input.getKey("shift-enter").clicked) { if (curMenu.getEntries().length == 0) return; // switch inventories Inventory from, to; diff --git a/src/main/java/minicraft/screen/CraftingDisplay.java b/src/main/java/minicraft/screen/CraftingDisplay.java index e25e3f662..5843856ad 100644 --- a/src/main/java/minicraft/screen/CraftingDisplay.java +++ b/src/main/java/minicraft/screen/CraftingDisplay.java @@ -103,12 +103,12 @@ public void tick(InputHandler input) { refreshData(); } - if (input.isClicked("menu") || (isPersonalCrafter && input.isClicked("craft"))) { + if (input.getKey("menu").clicked || (isPersonalCrafter && input.getKey("craft").clicked)) { Game.exitDisplay(); return; } - if ((input.isClicked("select") || input.isClicked("attack")) && recipeMenu.getSelection() >= 0) { + if ((input.getKey("select").clicked || input.getKey("attack").clicked) && recipeMenu.getSelection() >= 0) { // check the selected recipe if (recipes.length == 0) return; Recipe selectedRecipe = recipes[recipeMenu.getSelection()]; diff --git a/src/main/java/minicraft/screen/Display.java b/src/main/java/minicraft/screen/Display.java index 0b7847ede..36c2d45d3 100644 --- a/src/main/java/minicraft/screen/Display.java +++ b/src/main/java/minicraft/screen/Display.java @@ -43,7 +43,7 @@ public void onExit() {} public void tick(InputHandler input) { - if (canExit && input.isClicked("exit")) { + if (canExit && input.getKey("exit").clicked) { Game.exitDisplay(); return; } diff --git a/src/main/java/minicraft/screen/InventoryMenu.java b/src/main/java/minicraft/screen/InventoryMenu.java index 804f431a9..de47745f2 100644 --- a/src/main/java/minicraft/screen/InventoryMenu.java +++ b/src/main/java/minicraft/screen/InventoryMenu.java @@ -30,9 +30,9 @@ class InventoryMenu extends ItemListMenu { public void tick(InputHandler input) { super.tick(input); - boolean dropOne = input.isClicked("drop-one"); + boolean dropOne = input.getKey("drop-one").clicked; - if(getNumOptions() > 0 && (dropOne || input.isClicked("drop-stack"))) { + if(getNumOptions() > 0 && (dropOne || input.getKey("drop-stack").clicked)) { ItemEntry entry = ((ItemEntry)getCurEntry()); if(entry == null) return; Item invItem = entry.getItem(); diff --git a/src/main/java/minicraft/screen/Menu.java b/src/main/java/minicraft/screen/Menu.java index dad697b3a..99980d213 100644 --- a/src/main/java/minicraft/screen/Menu.java +++ b/src/main/java/minicraft/screen/Menu.java @@ -153,8 +153,8 @@ public void tick(InputHandler input) { if(!selectable || entries.size() == 0) return; int prevSel = selection; - if (input.isClicked("cursor-up")) selection--; - if (input.isClicked("cursor-down")) selection++; + if (input.getKey("cursor-up").clicked) selection--; + if (input.getKey("cursor-down").clicked) selection++; if (input.getKey("shift-cursor-up").clicked && selectionSearcher == 0) selectionSearcher -= 2; if (input.getKey("shift-cursor-down").clicked && selectionSearcher == 0) selectionSearcher += 2; if (prevSel != selection && selectionSearcher != 0) selection = prevSel; diff --git a/src/main/java/minicraft/screen/OptionsWorldDisplay.java b/src/main/java/minicraft/screen/OptionsWorldDisplay.java index 50aa60f73..b585efa02 100644 --- a/src/main/java/minicraft/screen/OptionsWorldDisplay.java +++ b/src/main/java/minicraft/screen/OptionsWorldDisplay.java @@ -49,11 +49,11 @@ public OptionsWorldDisplay() { @Override public void tick(InputHandler input) { if (confirmOff) { - if (input.isClicked("exit")) { + if (input.getKey("exit").clicked) { confirmOff = false; menus[1].shouldRender = false; selection = 0; - } else if (input.isClicked("select")) { + } else if (input.getKey("select").clicked) { confirmOff = false; QuestsDisplay.tutorialOff(); diff --git a/src/main/java/minicraft/screen/PauseDisplay.java b/src/main/java/minicraft/screen/PauseDisplay.java index f442a88b7..2abd7f004 100644 --- a/src/main/java/minicraft/screen/PauseDisplay.java +++ b/src/main/java/minicraft/screen/PauseDisplay.java @@ -36,16 +36,12 @@ public PauseDisplay() { new SelectEntry("minicraft.displays.pause.menu", () -> { ArrayList items = new ArrayList<>(Arrays.asList(StringEntry.useLines("minicraft.displays.pause.display.exit_popup.0"))); - items.add(new BlankEntry()); items.addAll(Arrays.asList(StringEntry.useLines(Color.RED, Localization.getLocalized("minicraft.displays.pause.display.exit_popup.1")))); items.add(new BlankEntry()); - items.add(new BlankEntry()); items.add(new SelectEntry("minicraft.displays.pause.display.exit_popup.cancel", Game::exitDisplay)); - items.add(new SelectEntry("minicraft.displays.pause.display.exit_popup.quit", () -> Game.setDisplay(new TitleDisplay()))); - Game.setDisplay(new Display(false, true, new Menu.Builder(true, 8, RelPos.CENTER, items - ).createMenu())); + Game.setDisplay(new PopupDisplay(new PopupDisplay.PopupConfig(null, null, 8), items.toArray(new ListEntry[0]))); }), new BlankEntry(), @@ -69,7 +65,7 @@ public void init(Display parent) { @Override public void tick(InputHandler input) { super.tick(input); - if (input.isClicked("pause")) + if (input.getKey("pause").clicked) Game.exitDisplay(); } } diff --git a/src/main/java/minicraft/screen/PlayerInvDisplay.java b/src/main/java/minicraft/screen/PlayerInvDisplay.java index 4a53c453a..d4d4f9a39 100644 --- a/src/main/java/minicraft/screen/PlayerInvDisplay.java +++ b/src/main/java/minicraft/screen/PlayerInvDisplay.java @@ -47,7 +47,7 @@ public PlayerInvDisplay(Player player) { public void tick(InputHandler input) { super.tick(input); - if(input.isClicked("menu")) { + if(input.getKey("menu").clicked) { Game.exitDisplay(); return; } @@ -60,7 +60,7 @@ public void tick(InputHandler input) { Inventory from, to; if (selection == 0) { - if (input.isClicked("attack") && menus[0].getNumOptions() > 0) { + if (input.getKey("attack").clicked && menus[0].getNumOptions() > 0) { player.activeItem = player.getInventory().remove(menus[0].getSelection()); Game.exitDisplay(); return; @@ -97,7 +97,7 @@ public void tick(InputHandler input) { Item fromItem = from.get(fromSel); boolean transferAll; - if (input.isClicked("attack")) { // If stack limit is available, this can transfer whole stack + if (input.getKey("attack").clicked) { // If stack limit is available, this can transfer whole stack transferAll = !(fromItem instanceof StackableItem) || ((StackableItem)fromItem).count == 1; } else return; @@ -112,7 +112,7 @@ public void tick(InputHandler input) { } } else { - if (input.isClicked("attack") && menus[0].getNumOptions() > 0) { + if (input.getKey("attack").clicked && menus[0].getNumOptions() > 0) { player.activeItem = player.getInventory().remove(menus[0].getSelection()); Game.exitDisplay(); } diff --git a/src/main/java/minicraft/screen/PopupDisplay.java b/src/main/java/minicraft/screen/PopupDisplay.java index 9213e56e4..b24134967 100644 --- a/src/main/java/minicraft/screen/PopupDisplay.java +++ b/src/main/java/minicraft/screen/PopupDisplay.java @@ -40,7 +40,7 @@ public PopupDisplay(@Nullable PopupConfig config, boolean clearScreen, boolean m public void tick(InputHandler input) { if (callbacks != null) { for (PopupActionCallback callback : callbacks) { - if (callback.key == null || input.isClicked(callback.key)) { + if (callback.key == null || input.getKey(callback.key).clicked) { if (callback.callback != null && callback.callback.acts(menus[0])) { // This overrides the original #tick check. return; diff --git a/src/main/java/minicraft/screen/QuestsDisplay.java b/src/main/java/minicraft/screen/QuestsDisplay.java index e75bb9a74..618ede229 100644 --- a/src/main/java/minicraft/screen/QuestsDisplay.java +++ b/src/main/java/minicraft/screen/QuestsDisplay.java @@ -237,7 +237,7 @@ series.unlocked? new StringEntry("Status: Unlocked (" + completedQuestNum + "/" @Override public void tick(InputHandler input) { super.tick(input); - if (input.isClicked("select")) { + if (input.getKey("select").clicked) { skipSeries(series); display.reloadEntries(); if (display.menus[0].getSelection() > display.seriesEntries[display.selectedEntry].length) { @@ -554,12 +554,12 @@ public static void loadGameQuests(ArrayList unlocked, ArrayList public void tick(InputHandler input) { super.tick(input); - if (input.isClicked("cursor-left")) if (selectedEntry > 0) { + if (input.getKey("cursor-left").clicked) if (selectedEntry > 0) { selectedEntry--; updateEntries(); } - if (input.isClicked("cursor-right")) if (selectedEntry < 1) { + if (input.getKey("cursor-right").clicked) if (selectedEntry < 1) { selectedEntry++; updateEntries(); } diff --git a/src/main/java/minicraft/screen/entry/KeyInputEntry.java b/src/main/java/minicraft/screen/entry/KeyInputEntry.java index b4814666d..2644d8c9c 100644 --- a/src/main/java/minicraft/screen/entry/KeyInputEntry.java +++ b/src/main/java/minicraft/screen/entry/KeyInputEntry.java @@ -28,11 +28,8 @@ private void setMapping(String mapping, Set duplicated) { String newMapping = ""; for (String k : mapping.split("\\|")) { - if (duplicated.contains(k)) - newMapping += Color.RED_CODE; - else - newMapping += Color.WHITE_CODE + Color.GRAY_CODE; - + if (duplicated.contains(k)) k = Color.RED_CODE + k; + k = Color.GRAY_CODE + k + Color.WHITE_CODE; newMapping += k + "|"; }