diff options
author | nopothegamer <40329022+nopothegamer@users.noreply.github.com> | 2021-07-22 09:42:35 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 09:42:35 +1000 |
commit | 8d9aeb9e47eba0ef4275b64592bc6dcd7696e0f9 (patch) | |
tree | 8bdff2cfe3dc071978576c816f5f29ab39a2284a /src | |
parent | 87058a95f50768ccbd1b1fed0a8f0600bf81304e (diff) | |
parent | aebc16a2a5ca9c20affc27eb5a45cd9a95085168 (diff) | |
download | NotEnoughUpdates-8d9aeb9e47eba0ef4275b64592bc6dcd7696e0f9.tar.gz NotEnoughUpdates-8d9aeb9e47eba0ef4275b64592bc6dcd7696e0f9.tar.bz2 NotEnoughUpdates-8d9aeb9e47eba0ef4275b64592bc6dcd7696e0f9.zip |
Merge pull request #1 from DoKM/master
Diffstat (limited to 'src')
4 files changed, 57 insertions, 16 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index b8d6dc38..2dd0fbd1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -40,6 +40,7 @@ import org.lwjgl.util.vector.Vector4f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; +import java.awt.event.KeyEvent; import java.util.*; import java.util.List; @@ -1439,7 +1440,9 @@ public class StorageOverlay extends GuiElement { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return false; int dWheel = Mouse.getEventDWheel(); - if(dWheel != 0) { + if(dWheel != 0 && + (((NotEnoughUpdates.INSTANCE.config.storageGUI.scrollLock == 0)|| + (NotEnoughUpdates.INSTANCE.config.storageGUI.scrollLock == 1 && !KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.slotLockKey))))) { if(dWheel < 0) { dWheel = -1; if(scrollVelocity > 0) scrollVelocity = 0; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java index 17c25117..2b48bc74 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java @@ -102,6 +102,28 @@ public class StorageGUI { @ConfigAccordionId(id = 1)
public String selectedStorageColour = "0:255:255:223:0";
+ @Expose
+ @ConfigOption(
+ name = "Scroll Lock",
+ desc = "Stop scrolling when holding the key below.\n"+
+ "Usefull for people using scrollable tooltips."
+ )
+ @ConfigEditorDropdown(
+ values = {"Off", "On"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int scrollLock = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Scroll Lock Key",
+ desc = "Hold this keep to stop scrolling in the gui.\n" +
+ "Don't forget to enable it above."
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LSHIFT)
+ @ConfigAccordionId(id = 1)
+ public int slotLockKey = Keyboard.KEY_LSHIFT;
+
@ConfigOption(
name = "Inventory Backpacks",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index fd70dadc..acd1f99d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -616,8 +616,9 @@ public class GuiProfileViewer extends GuiScreen { int invSizeY = inventoryRows*18+17+7;
int y = guiTop+101-invSizeY/2;
+ int staticSelectorHeight = guiTop+177;
- if(mouseY > y+invSizeY && mouseY < y+invSizeY+16) {
+ if(mouseY > staticSelectorHeight && mouseY < staticSelectorHeight+16) {
if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) {
if(mouseX < guiLeft+320) {
currentInventoryIndex--;
@@ -1590,8 +1591,9 @@ public class GuiProfileViewer extends GuiScreen { static {
invNameToDisplayMap.put("inv_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.chest), EnumChatFormatting.GRAY+"Inventory"));
invNameToDisplayMap.put("ender_chest_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.ender_chest), EnumChatFormatting.GRAY+"Ender Chest"));
- invNameToDisplayMap.put("backpack_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dropper), EnumChatFormatting.GRAY+"Backpacks"));
- invNameToDisplayMap.put("personal_vault_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dispenser), EnumChatFormatting.GRAY+"Personal vault"));
+ //invNameToDisplayMap.put("backpack_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dropper), EnumChatFormatting.GRAY+"Backpacks"));
+ invNameToDisplayMap.put("backpack_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")).setStackDisplayName(EnumChatFormatting.GRAY+"Backpacks"));
+ invNameToDisplayMap.put("personal_vault_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")).setStackDisplayName(EnumChatFormatting.GRAY+"Personal vault"));
invNameToDisplayMap.put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY+"Accessory Bag"));
invNameToDisplayMap.put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY+"Wardrobe"));
invNameToDisplayMap.put("fishing_bag", Utils.createItemStack(Items.fish, EnumChatFormatting.GRAY+"Fishing Bag"));
@@ -1993,6 +1995,7 @@ public class GuiProfileViewer extends GuiScreen { int x = guiLeft+320-176/2;
int y = guiTop+101-invSizeY/2;
+ int staticSelectorHeight = guiTop+177;
this.drawTexturedModalRect(x, y, 0, 0, 176, inventoryRows*18+17);
this.drawTexturedModalRect(x, y+inventoryRows*18+17, 0, 215, 176, 7);
@@ -2000,7 +2003,7 @@ public class GuiProfileViewer extends GuiScreen { boolean leftHovered = false;
boolean rightHovered = false;
if(Mouse.isButtonDown(0)) {
- if(mouseY > y+invSizeY && mouseY < y+invSizeY+16) {
+ if(mouseY > staticSelectorHeight && mouseY < staticSelectorHeight+16) {
if(mouseX > guiLeft+320-12 && mouseX < guiLeft+320+12) {
if(mouseX < guiLeft+320) {
leftHovered = true;
@@ -2013,11 +2016,11 @@ public class GuiProfileViewer extends GuiScreen { Minecraft.getMinecraft().getTextureManager().bindTexture(resource_packs);
if(currentInventoryIndex > 0) {
- Utils.drawTexturedRect(guiLeft+320-12, y+invSizeY, 12, 16,
+ Utils.drawTexturedRect(guiLeft+320-12, staticSelectorHeight, 12, 16,
29/256f, 53/256f, !leftHovered?0:32/256f, !leftHovered?32/256f:64/256f, GL11.GL_NEAREST);
}
if(currentInventoryIndex < inventories.length-1) {
- Utils.drawTexturedRect(guiLeft+320, y+invSizeY, 12, 16,
+ Utils.drawTexturedRect(guiLeft+320, staticSelectorHeight, 12, 16,
5/256f, 29/256f, !rightHovered?0:32/256f, !rightHovered?32/256f:64/256f, GL11.GL_NEAREST);
}
@@ -2220,7 +2223,7 @@ public class GuiProfileViewer extends GuiScreen { guiLeft+xStart+xOffset, guiTop+yStartBottom, 76);
Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_3,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset, 76);
- Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_4,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T5", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_4,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*2, 76);
Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T3", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_2,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*3, 76);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index 5968fdce..b4fce512 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -79,7 +79,7 @@ public class ProfileViewer { collectionCatToCollectionMap.put(CAT_MINING,
Utils.createList("COBBLESTONE", "COAL", "IRON_INGOT", "GOLD_INGOT", "DIAMOND", "INK_SACK:4",
"EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE_DUST", "GRAVEL", "ICE", "NETHERRACK",
- "SAND", "ENDER_STONE"));
+ "SAND", "ENDER_STONE", "MITHRIL_ORE", "HARD_STONE", "GEMSTONE_COLLECTION"));
collectionCatToCollectionMap.put(CAT_COMBAT,
Utils.createList("ROTTEN_FLESH", "BONE", "STRING", "SPIDER_EYE", "SULPHUR", "ENDER_PEARL",
"GHAST_TEAR", "SLIME_BALL", "BLAZE_ROD", "MAGMA_CREAM"));
@@ -99,7 +99,7 @@ public class ProfileViewer { collectionCatToMinionMap.put(CAT_MINING,
Utils.createList("COBBLESTONE", "COAL", "IRON", "GOLD", "DIAMOND", "LAPIS",
"EMERALD", "REDSTONE", "QUARTZ", "OBSIDIAN", "GLOWSTONE", "GRAVEL", "ICE", null,
- "SAND", "ENDER_STONE"));
+ "SAND", "ENDER_STONE", "MITHRIL", "HARD_STONE", null));
collectionCatToMinionMap.put(CAT_COMBAT,
Utils.createList("ZOMBIE", "SKELETON", "SPIDER", "CAVESPIDER", "CREEPER", "ENDERMAN",
"GHAST", "SLIME", "BLAZE", "MAGMA_CUBE"));
@@ -182,6 +182,15 @@ public class ProfileViewer { EnumChatFormatting.GRAY+"Sand"));
collectionToCollectionDisplayMap.put("ENDER_STONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.end_stone),
EnumChatFormatting.GRAY+"End Stone"));
+ collectionToCollectionDisplayMap.put("MITHRIL_ORE", Utils.createItemStack(Items.prismarine_crystals,
+ EnumChatFormatting.GRAY+"Mithril"));
+ collectionToCollectionDisplayMap.put("HARD_STONE", Utils.createItemStack(Item.getItemFromBlock(Blocks.stone),
+ EnumChatFormatting.GRAY+"Hard Stone"));
+ ItemStack gemstone = Utils.createItemStack(Item.getItemFromBlock(Blocks.stained_glass),
+ EnumChatFormatting.GRAY+"Gem Stones");
+ gemstone.setItemDamage(14);
+ collectionToCollectionDisplayMap.put("GEMSTONE_COLLECTION", gemstone);
+
/** COMBAT COLLECTIONS **/
collectionToCollectionDisplayMap.put("ROTTEN_FLESH", Utils.createItemStack(Items.rotten_flesh,
@@ -826,19 +835,23 @@ public class ProfileViewer { return inventoryInfo;
}
- public JsonObject getBackpackData(JsonObject backpack_contents_json, JsonObject backpack_icons) {
-
+ public boolean checkIfValidJson(JsonElement element){
+ return element != null;
+ }
- for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
- System.out.println(ste);
- }
+ public JsonObject getBackpackData(JsonObject backpack_contents_json, JsonObject backpack_icons) {
JsonArray contents = new JsonArray();
+ if(!(checkIfValidJson(backpack_contents_json) && checkIfValidJson(backpack_icons))){
+ JsonObject bundledReturn = new JsonObject();
+ bundledReturn.add("contents", new JsonArray());
+ bundledReturn.add("backpack_sizes", new JsonArray());
+ return bundledReturn;
+ }
String[] backpackArray = new String[0];
-
//Create backpack array which sizes up
for(Map.Entry<String, JsonElement> backpackIcon : backpack_icons.entrySet()) {
if(backpackIcon.getValue() instanceof JsonObject){
|