From 275fe45caa8eb1048914d864aafae21f3f3a1157 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sat, 3 Oct 2020 06:09:28 +1000 Subject: 1.3.3-ALPA --- build.gradle | 6 +- deps/Morus-1.0.jar | Bin 0 -> 74917 bytes .../notenoughupdates/AccessoryBagOverlay.java | 527 +++++++++++++ .../notenoughupdates/BetterContainers.java | 333 ++++++++ .../moulberry/notenoughupdates/BetterPortals.java | 206 +++++ .../moulberry/notenoughupdates/GuiTextures.java | 5 + .../notenoughupdates/MorusIntegration.java | 60 ++ .../notenoughupdates/NEUEventListener.java | 29 +- .../moulberry/notenoughupdates/NEUOverlay.java | 171 +++- .../notenoughupdates/NEUOverlayPlacements.java | 63 +- .../notenoughupdates/NotEnoughUpdates.java | 18 +- .../moulberry/notenoughupdates/SBAIntegration.java | 21 +- .../moulberry/notenoughupdates/TradeWindow.java | 22 +- .../notenoughupdates/auction/APIManager.java | 78 +- .../notenoughupdates/auction/CustomAH.java | 4 +- .../notenoughupdates/infopanes/DevInfoPane.java | 862 ++++++++++++++++++++- .../infopanes/SettingsInfoPane.java | 2 + .../notenoughupdates/mbgui/MBAnchorPoint.java | 18 +- .../notenoughupdates/mbgui/MBDeserializer.java | 20 + .../notenoughupdates/mbgui/MBGuiElement.java | 2 + .../notenoughupdates/mbgui/MBGuiGroupAligned.java | 67 ++ .../notenoughupdates/mbgui/MBGuiGroupFloating.java | 23 +- .../notenoughupdates/mbgui/MBGuiGroupHorz.java | 47 -- .../notenoughupdates/mixins/MixinGuiChest.java | 32 + .../notenoughupdates/mixins/MixinGuiContainer.java | 52 ++ .../notenoughupdates/options/Options.java | 12 + .../profileviewer/GuiProfileViewer.java | 67 +- .../profileviewer/PlayerStats.java | 21 +- .../profileviewer/ProfileViewer.java | 162 +--- .../notenoughupdates/util/HypixelApi.java | 2 + .../moulberry/notenoughupdates/util/TexLoc.java | 8 +- .../notenoughupdates/accessory_bag_overlay.png | Bin 0 -> 973 bytes .../dynamic_54/dynamic_54_button_ctm.png | Bin 0 -> 543 bytes .../dynamic_54/style1/dynamic_54.png | Bin 0 -> 5234 bytes .../dynamic_54/style1/dynamic_54_button_ctm.png | Bin 0 -> 607 bytes .../dynamic_54/style1/dynamic_54_slot_ctm.png | Bin 0 -> 539 bytes .../dynamic_54/style2/dynamic_54.png | Bin 0 -> 5429 bytes .../dynamic_54/style3/dynamic_54.png | Bin 0 -> 5519 bytes .../dynamic_54/style3/dynamic_54_button_ctm.png | Bin 0 -> 539 bytes .../dynamic_54/style4/dynamic_54_button_ctm.png | Bin 0 -> 3437 bytes .../assets/notenoughupdates/item_haschild.png | Bin 0 -> 263 bytes .../notenoughupdates/quickcommand_background.png | Bin 0 -> 429 bytes .../notenoughupdates/shaders/space_cape.frag | 6 +- src/main/resources/mixins.notenoughupdates.json | 4 +- 44 files changed, 2571 insertions(+), 379 deletions(-) create mode 100644 deps/Morus-1.0.jar create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/BetterPortals.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBDeserializer.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupAligned.java delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupHorz.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java create mode 100644 src/main/resources/assets/notenoughupdates/accessory_bag_overlay.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/dynamic_54_button_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_button_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_slot_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style2/dynamic_54.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54_button_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/dynamic_54/style4/dynamic_54_button_ctm.png create mode 100644 src/main/resources/assets/notenoughupdates/item_haschild.png create mode 100644 src/main/resources/assets/notenoughupdates/quickcommand_background.png diff --git a/build.gradle b/build.gradle index 9155a4eb..06d19abe 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'com.github.johnrengelman.shadow' sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = "1.2.2-BETA" +version = "1.3-REL" group= "io.github.moulberry" archivesBaseName = "NotEnoughUpdates" String modid = "notenoughupdates" @@ -34,6 +34,9 @@ minecraft { repositories { jcenter() maven { url 'https://repo.spongepowered.org/maven/' } + flatDir { + dirs 'deps' + } } dependencies { @@ -42,6 +45,7 @@ dependencies { //compile('org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r') compile('com.fasterxml.jackson.core:jackson-core:2.10.2') compile('info.bliki.wiki:bliki-core:3.1.0') + implementation name: 'Morus-1.0' } mixin { diff --git a/deps/Morus-1.0.jar b/deps/Morus-1.0.jar new file mode 100644 index 00000000..92276d72 Binary files /dev/null and b/deps/Morus-1.0.jar differ diff --git a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java new file mode 100644 index 00000000..65d4efc7 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java @@ -0,0 +1,527 @@ +package io.github.moulberry.notenoughupdates; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; + +import java.awt.*; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.*; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static io.github.moulberry.notenoughupdates.GuiTextures.*; + +public class AccessoryBagOverlay { + + private static final int TAB_BASIC = 0; + private static final int TAB_TOTAL = 1; + private static final int TAB_BONUS = 2; + private static final int TAB_DUP = 3; + private static final int TAB_MISSING = 4; + + private static final ItemStack[] TAB_STACKS = new ItemStack[] { + Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA+"Basic Information", + 10, EnumChatFormatting.GREEN+"- Talis count by rarity"), + Utils.createItemStack(Items.diamond_sword, EnumChatFormatting.DARK_AQUA+"Total Stat Bonuses", + 0), + Utils.createItemStack(Item.getItemFromBlock(Blocks.anvil), EnumChatFormatting.DARK_AQUA+"Total Stat Bonuses (from reforges)", + 0), + Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA+"Duplicates", + 8), + Utils.createItemStack(Item.getItemFromBlock(Blocks.barrier), EnumChatFormatting.DARK_AQUA+"Missing", + 0), + }; + + private static int currentTab = TAB_BASIC; + + public static boolean mouseClick() { + if(!Mouse.getEventButtonState()) return false; + try { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + + int mouseX = Mouse.getX() / scaledResolution.getScaleFactor(); + int mouseY = height - Mouse.getY() / scaledResolution.getScaleFactor(); + + int xSize = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "xSize", "field_146999_f"); + int ySize = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "ySize", "field_147000_g"); + int guiLeft = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "guiLeft", "field_147003_i"); + int guiTop = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "guiTop", "field_147009_r"); + + if(mouseX < guiLeft+xSize+3 || mouseX > guiLeft+xSize+80+28) return false; + if(mouseY < guiTop || mouseY > guiTop+166) return false; + + if(mouseX > guiLeft+xSize+83 && mouseY < guiTop+20*TAB_MISSING+22) { + currentTab = (mouseY - guiTop)/20; + if(currentTab < 0) currentTab = 0; + if(currentTab > TAB_MISSING) currentTab = TAB_MISSING; + } + + return true; + } catch(Exception e) { + return false; + } + } + + public static void resetCache() { + accessoryStacks = new HashSet<>(); + pagesVisited = new HashSet<>(); + talismanCountRarity = null; + totalStats = null; + reforgeStats = null; + } + + private static Set accessoryStacks = new HashSet<>(); + private static Set pagesVisited = new HashSet<>(); + + public static void renderVisitOverlay(int x, int y) { + Utils.drawStringCenteredScaledMaxWidth("Please visit all", Minecraft.getMinecraft().fontRendererObj, x+40, y+78, true, 70, -1); + Utils.drawStringCenteredScaledMaxWidth("pages of the bag", Minecraft.getMinecraft().fontRendererObj, x+40, y+86, true, 70, -1); + } + + private static TreeMap talismanCountRarity = null; + public static void renderBasicOverlay(int x, int y) { + if(talismanCountRarity == null) { + talismanCountRarity = new TreeMap<>(); + for(ItemStack stack : accessoryStacks) { + int rarity = getRarity(stack); + if(rarity >= 0) { + talismanCountRarity.put(rarity, talismanCountRarity.getOrDefault(rarity, 0)+1); + } + } + } + + Utils.drawStringCenteredScaledMaxWidth("# By Rarity", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 70, + new Color(80, 80, 80).getRGB()); + + int yIndex = 0; + for(Map.Entry entry : talismanCountRarity.descendingMap().entrySet()) { + String rarityName = rarityArrC[entry.getKey()]; + renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString()+entry.getValue(), x+5, y+20+11*yIndex, 70); + yIndex++; + } + } + + + private static PlayerStats.Stats totalStats = null; + public static void renderTotalStatsOverlay(int x, int y) { + if(totalStats == null) { + totalStats = new PlayerStats.Stats(); + for(ItemStack stack : accessoryStacks) { + if(stack != null) totalStats.add(getStatForItem(stack, STAT_PATTERN_MAP, true)); + } + } + + Utils.drawStringCenteredScaledMaxWidth("Total Stats", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 70, + new Color(80, 80, 80).getRGB()); + int yIndex = 0; + for(int i=0; i duplicates = new HashSet<>(); + public static void renderDuplicatesOverlay(int x, int y) { + Utils.drawStringCenteredScaledMaxWidth("Duplicates", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 70, + new Color(80, 80, 80).getRGB()); + } + + public static void renderMissingOverlay(int x, int y) { + } + + public static void renderOverlay() { + if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest cc = (ContainerChest) eventGui.inventorySlots; + String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.trim().startsWith("Accessory Bag")) { + try { + int xSize = (int) Utils.getField(GuiContainer.class, eventGui, "xSize", "field_146999_f"); + int ySize = (int) Utils.getField(GuiContainer.class, eventGui, "ySize", "field_147000_g"); + int guiLeft = (int) Utils.getField(GuiContainer.class, eventGui, "guiLeft", "field_147003_i"); + int guiTop = (int) Utils.getField(GuiContainer.class, eventGui, "guiTop", "field_147009_r"); + + if(accessoryStacks.isEmpty()) { + for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { + if(stack != null && isAccessory(stack)) { + accessoryStacks.add(stack); + } + } + } + + if(containerName.trim().contains("(")) { + String first = containerName.trim().split("\\(")[1].split("/")[0]; + Integer currentPageNumber = Integer.parseInt(first); + //System.out.println("current:"+currentPageNumber); + if(!pagesVisited.contains(currentPageNumber)) { + boolean hasStack = false; + if(Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { + IInventory inv = ((ContainerChest)Minecraft.getMinecraft().thePlayer.openContainer).getLowerChestInventory(); + for(int i=0; i pagesVisited.size()) { + Minecraft.getMinecraft().getTextureManager().bindTexture(accessory_bag_overlay); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTop, 80, 149, 0, 80/256f, 0, 149/256f, GL11.GL_NEAREST); + + renderVisitOverlay(guiLeft+xSize+3, guiTop); + return; + } + } else if(pagesVisited.isEmpty()) { + boolean hasStack = false; + if(Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { + IInventory inv = ((ContainerChest)Minecraft.getMinecraft().thePlayer.openContainer).getLowerChestInventory(); + for(int i=0; i= length) { + for(int xOff=-2; xOff<=2; xOff++) { + for(int yOff=-2; yOff<=2; yOff++) { + if(Math.abs(xOff) != Math.abs(yOff)) { + Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(first + " " + second), Minecraft.getMinecraft().fontRendererObj, + x+length/2f+xOff/2f, y+4+yOff/2f, false, length, + new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB()); + } + } + } + + GlStateManager.color(1, 1, 1, 1); + Utils.drawStringCenteredScaledMaxWidth(first + " " + second, Minecraft.getMinecraft().fontRendererObj, + x+length/2f, y+4, false, length, 4210752); + } else { + for(int xOff=-2; xOff<=2; xOff++) { + for(int yOff=-2; yOff<=2; yOff++) { + if(Math.abs(xOff) != Math.abs(yOff)) { + fontRendererObj.drawString(Utils.cleanColourNotModifiers(first), + x+xOff/2f, y+yOff/2f, + new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false); + } + } + } + + int secondLen = fontRendererObj.getStringWidth(second); + GlStateManager.color(1, 1, 1, 1); + fontRendererObj.drawString(first, x, y, 4210752, false); + for(int xOff=-2; xOff<=2; xOff++) { + for(int yOff=-2; yOff<=2; yOff++) { + if(Math.abs(xOff) != Math.abs(yOff)) { + fontRendererObj.drawString(Utils.cleanColourNotModifiers(second), + x+length-secondLen+xOff/2f, y+yOff/2f, + new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false); + } + } + } + + GlStateManager.color(1, 1, 1, 1); + fontRendererObj.drawString(second, x+length-secondLen, y, 4210752, false); + } + } + + private static final Pattern HEALTH_PATTERN_BONUS = Pattern.compile("^Health: (?:\\+|-)[0-9]+ HP \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern DEFENCE_PATTERN_BONUS = Pattern.compile("^Defense: (?:\\+|-)[0-9]+ \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern STRENGTH_PATTERN_BONUS = Pattern.compile("^Strength: (?:\\+|-)[0-9]+ \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern SPEED_PATTERN_BONUS = Pattern.compile("^Speed: (?:\\+|-)[0-9]+ \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern CC_PATTERN_BONUS = Pattern.compile("^Crit Chance: (?:\\+|-)[0-9]+% \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern CD_PATTERN_BONUS = Pattern.compile("^Crit Damage: (?:\\+|-)[0-9]+% \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern ATKSPEED_PATTERN_BONUS = Pattern.compile("^Bonus Attack Speed: (?:\\+|-)[0-9]+% \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern INTELLIGENCE_PATTERN_BONUS = Pattern.compile("^Intelligence: (?:\\+|-)[0-9]+ \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final Pattern SCC_PATTERN_BONUS = Pattern.compile("^Sea Creature Chance: (?:\\+|-)[0-9]+ \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final HashMap STAT_PATTERN_MAP_BONUS = new HashMap<>(); + static { + STAT_PATTERN_MAP_BONUS.put("health", HEALTH_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("defence", DEFENCE_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("strength", STRENGTH_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("speed", SPEED_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("crit_chance", CC_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("crit_damage", CD_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("bonus_attack_speed", ATKSPEED_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("intelligence", INTELLIGENCE_PATTERN_BONUS); + STAT_PATTERN_MAP_BONUS.put("sea_creature_chance", SCC_PATTERN_BONUS); + } + + private static final Pattern HEALTH_PATTERN = Pattern.compile("^Health: ((?:\\+|-)[0-9]+)"); + private static final Pattern DEFENCE_PATTERN = Pattern.compile("^Defense: ((?:\\+|-)[0-9]+)"); + private static final Pattern STRENGTH_PATTERN = Pattern.compile("^Strength: ((?:\\+|-)[0-9]+)"); + private static final Pattern SPEED_PATTERN = Pattern.compile("^Speed: ((?:\\+|-)[0-9]+)"); + private static final Pattern CC_PATTERN = Pattern.compile("^Crit Chance: ((?:\\+|-)[0-9]+)"); + private static final Pattern CD_PATTERN = Pattern.compile("^Crit Damage: ((?:\\+|-)[0-9]+)"); + private static final Pattern ATKSPEED_PATTERN = Pattern.compile("^Bonus Attack Speed: ((?:\\+|-)[0-9]+)"); + private static final Pattern INTELLIGENCE_PATTERN = Pattern.compile("^Intelligence: ((?:\\+|-)[0-9]+)"); + private static final Pattern SCC_PATTERN = Pattern.compile("^Sea Creature Chance: ((?:\\+|-)[0-9]+)"); + private static final HashMap STAT_PATTERN_MAP = new HashMap<>(); + static { + STAT_PATTERN_MAP.put("health", HEALTH_PATTERN); + STAT_PATTERN_MAP.put("defence", DEFENCE_PATTERN); + STAT_PATTERN_MAP.put("strength", STRENGTH_PATTERN); + STAT_PATTERN_MAP.put("speed", SPEED_PATTERN); + STAT_PATTERN_MAP.put("crit_chance", CC_PATTERN); + STAT_PATTERN_MAP.put("crit_damage", CD_PATTERN); + STAT_PATTERN_MAP.put("bonus_attack_speed", ATKSPEED_PATTERN); + STAT_PATTERN_MAP.put("intelligence", INTELLIGENCE_PATTERN); + STAT_PATTERN_MAP.put("sea_creature_chance", SCC_PATTERN); + } + private static PlayerStats.Stats getStatForItem(ItemStack stack, HashMap patternMap, boolean addExtras) { + String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); + NBTTagCompound tag = stack.getTagCompound(); + PlayerStats.Stats stats = new PlayerStats.Stats(); + + if(internalname == null) { + return stats; + } + + if(tag != null) { + NBTTagCompound display = tag.getCompoundTag("display"); + if (display.hasKey("Lore", 9)) { + NBTTagList list = display.getTagList("Lore", 8); + for (int i = 0; i < list.tagCount(); i++) { + String line = list.getStringTagAt(i); + for(Map.Entry entry : patternMap.entrySet()) { + Matcher matcher = entry.getValue().matcher(Utils.cleanColour(line)); + if(matcher.find()) { + int bonus = Integer.parseInt(matcher.group(1)); + stats.addStat(entry.getKey(), bonus); + } + } + } + } + } + + if(!addExtras) return stats; + + if(internalname.equals("DAY_CRYSTAL") || internalname.equals("NIGHT_CRYSTAL")) { + stats.addStat(PlayerStats.STRENGTH, 2.5f); + stats.addStat(PlayerStats.DEFENCE, 2.5f); + } + + if(internalname.equals("NEW_YEAR_CAKE_BAG") && tag != null && tag.hasKey("ExtraAttributes", 10)) { + NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); + + byte[] bytes = null; + for (String key : ea.getKeySet()) { + if (key.endsWith("backpack_data") || key.equals("new_year_cake_bag_data")) { + bytes = ea.getByteArray(key); + try { + NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes)); + NBTTagList items = contents_nbt.getTagList("i", 10); + HashSet cakes = new HashSet<>(); + for(int j=0; j 0) { + NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag"); + if(nbt != null && nbt.hasKey("ExtraAttributes", 10)) { + NBTTagCompound ea2 = nbt.getCompoundTag("ExtraAttributes"); + if (ea2.hasKey("new_years_cake")) { + cakes.add(ea2.getInteger("new_years_cake")); + } + } + } + } + stats.addStat(PlayerStats.HEALTH, cakes.size()); + } catch(IOException e) { + e.printStackTrace(); + return stats; + } + break; + } + } + } + return stats; + } + + private static String[] rarityArr = new String[] { + "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", + }; + private static String[] rarityArrC = new String[] { + EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", + EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", + EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", + EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", + EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", + EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", + EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", + EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", + }; + public static int checkItemType(ItemStack stack, boolean contains, String... typeMatches) { + NBTTagCompound tag = stack.getTagCompound(); + if(tag != null) { + NBTTagCompound display = tag.getCompoundTag("display"); + if (display.hasKey("Lore", 9)) { + NBTTagList list = display.getTagList("Lore", 8); + for (int i = list.tagCount()-1; i >= 0; i--) { + String line = list.getStringTagAt(i); + for(String rarity : rarityArr) { + for(int j=0; j= 0; + } + + public static int getRarity(ItemStack stack) { + NBTTagCompound tag = stack.getTagCompound(); + if(tag != null) { + NBTTagCompound display = tag.getCompoundTag("display"); + if (display.hasKey("Lore", 9)) { + NBTTagList list = display.getTagList("Lore", 8); + for (int i = list.tagCount(); i >= 0; i--) { + String line = list.getStringTagAt(i); + for(int j=0; j 0 && buttons[xi][yi-1]; + boolean right = xi < buttons.length-1 && buttons[xi+1][yi]; + boolean down = yi < buttons[xi].length-1 && buttons[xi][yi+1]; + boolean left = xi > 0 && buttons[xi-1][yi]; + + boolean upleft = yi > 0 && xi > 0 && buttons[xi-1][yi-1]; + boolean upright = yi > 0 && xi < buttons.length-1 && buttons[xi+1][yi-1]; + boolean downright = xi < buttons.length-1 && yi < buttons[xi+1].length-1 && buttons[xi+1][yi+1]; + boolean downleft = xi > 0 && yi < buttons[xi-1].length-1 && buttons[xi-1][yi+1]; + + int ctmIndex = getCTMIndex(up, right, down, left, upleft, upright, downright, downleft); + int[] rgbs = bufferedImageButton.getRGB((ctmIndex%12)*19*horzTexMult, (ctmIndex/12)*19*vertTexMult, + 18*horzTexMult, 18*vertTexMult, null, 0, 18*vertTexMult); + bufferedImageNew.setRGB(x, y, 18*horzTexMult, 18*vertTexMult, rgbs, 0, 18*vertTexMult); + } else { + boolean up = yi > 0 && slots[xi][yi-1]; + boolean right = xi < slots.length-1 && slots[xi+1][yi]; + boolean down = yi < slots[xi].length-1 && slots[xi][yi+1]; + boolean left = xi > 0 && slots[xi-1][yi]; + + boolean upleft = yi > 0 && xi > 0 && slots[xi-1][yi-1]; + boolean upright = yi > 0 && xi < slots.length-1 && slots[xi+1][yi-1]; + boolean downright = xi < slots.length-1 && yi < slots[xi+1].length-1 && slots[xi+1][yi+1]; + boolean downleft = xi > 0 && yi < slots[xi-1].length-1 && slots[xi-1][yi+1]; + + int ctmIndex = getCTMIndex(up, right, down, left, upleft, upright, downright, downleft); + int[] rgbs = bufferedImageSlot.getRGB((ctmIndex%12)*19*horzTexMult, (ctmIndex/12)*19*vertTexMult, + 18*horzTexMult, 18*vertTexMult, null, 0, 18*vertTexMult); + bufferedImageNew.setRGB(x, y, 18*horzTexMult, 18*vertTexMult, rgbs, 0, 18*vertTexMult); + } + } + } + texture = new DynamicTexture(bufferedImageNew); + } catch(Exception e) { + e.printStackTrace(); + } + } + } + + public static void reset() { + texture = null; + loaded = false; + clickedSlot = -1; + clickedSlotMillis = 0; + } + + private static boolean isChestOpen() { + return Minecraft.getMinecraft().currentScreen instanceof GuiChest && + NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && + (NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuBackgroundStyle.value >= 1 && + NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuButtonStyle.value >= 1); + } + + private static boolean hasItem() { + if(!isChestOpen()) return false; + Container container = ((GuiChest)Minecraft.getMinecraft().currentScreen).inventorySlots; + if(container instanceof ContainerChest) { + IInventory lower = ((ContainerChest)container).getLowerChestInventory(); + int size = lower.getSizeInventory(); + for(int index=0; index loadedPortals = new HashSet<>(); + private HashMap portalNameMap = new HashMap<>(); + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + portalNameMap.clear(); + loadedPortals.clear(); + } + + /** The current GL viewport */ + private static final IntBuffer VIEWPORT = GLAllocation.createDirectIntBuffer(16); + /** The current GL modelview matrix */ + private static final FloatBuffer MODELVIEW = GLAllocation.createDirectFloatBuffer(16); + /** The current GL projection matrix */ + private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16); + private static final FloatBuffer WINCOORDS = GLAllocation.createDirectFloatBuffer(3); + + private float getFOVModifier(float partialTicks) { + Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); + + float f = Minecraft.getMinecraft().gameSettings.fovSetting; + //f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks); + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F) { + float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(Minecraft.getMinecraft().theWorld, entity, partialTicks); + + if (block.getMaterial() == Material.water) { + f = f * 60.0F / 70.0F; + } + + return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(Minecraft.getMinecraft().entityRenderer, entity, block, partialTicks, f); + } + + TexLoc tl = new TexLoc(0, 1, Keyboard.KEY_M); + + @SubscribeEvent + public void renderWorld(RenderGameOverlayEvent event) { + + GlStateManager.getFloat(2982, MODELVIEW); + GlStateManager.getFloat(2983, PROJECTION); + GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT); + + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + GlStateManager.disableCull(); + + tl.handleKeyboardInput(); + + WINCOORDS.flip().limit(3); + + /*float objx = -(float)(0-player.posX); + float objy = (float)(100-player.posY-player.eyeHeight); + float objz = (float)(0-player.posZ);*/ + + float dX = -(float)(0-player.posX); + float dY = (float)(100-player.posY-player.eyeHeight); + float dZ = (float)(0-player.posZ); + + //GLU.gluProject(objx, objy, objz, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS); + + double x = dX*Math.cos(Math.toRadians(player.rotationYawHead))-dZ*Math.sin(Math.toRadians(player.rotationYawHead)); + double z = dX*Math.sin(Math.toRadians(player.rotationYawHead))+dZ*Math.cos(Math.toRadians(player.rotationYawHead)); + + float fov = getFOVModifier(event.partialTicks); + x = x / z * Math.toRadians(fov); + dY = (float)(dY / z * Math.toRadians(fov)); + + //System.out.println(z); + + //GLU.gluProject((float)x, dY, (float)z, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS); + //x = x / z * 2; + //dY = (float)(dY / z * 2); + + GL11.glEnable(GL11.GL_SCISSOR_TEST); + + GL11.glScissor((int)(x*Minecraft.getMinecraft().displayWidth*tl.x/tl.y)+Minecraft.getMinecraft().displayWidth/2, + (int)(dY+Minecraft.getMinecraft().displayHeight/2), 2, 2); + + drawRect(0, 0, 2000, 2000, -1); + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + + /*for(BlockPos pos : portalNameMap.keySet()) { + WINCOORDS.flip().limit(3); + + /*float objx = -(float)((pos.getX()-player.posX)*Math.cos(Math.toRadians(player.rotationYawHead))*Math.cos(Math.toRadians(player.rotationPitch))); + float objy = (float)((pos.getY()-player.posY)*Math.sin(Math.toRadians(player.rotationPitch))); + float objz = (float)((pos.getZ()-player.posZ)*Math.sin(Math.toRadians(player.rotationYawHead))); + + float objx = -(float)(pos.getX()-player.posX); + float objy = (float)(pos.getY()-player.posY-player.eyeHeight); + float objz = (float)(pos.getZ()-player.posZ); + + GLU.gluProject(objx, objy, objz, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS); + //GLU.glu + + GL11.glEnable(GL11.GL_SCISSOR_TEST); + + //System.out.println(WINCOORDS.get(1)); + + GL11.glScissor((int)WINCOORDS.get(0)*2, + Minecraft.getMinecraft().displayHeight-(int)WINCOORDS.get(1), (int)50, (int)50); + + //0-1 + //-1 - 1 + //0-1920 + + drawRect(0, 0, 2000, 2000, -1); + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + }*/ + + GlStateManager.enableCull(); + } + + @SubscribeEvent + public void tick(TickEvent.ClientTickEvent event) { + if(Minecraft.getMinecraft().theWorld != null) { + List travelToPositions = new ArrayList<>(); + for(Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) { + if(entity instanceof EntityArmorStand) { + EntityArmorStand armorStand = (EntityArmorStand) entity; + if(armorStand.isInvisible() && armorStand.hasCustomName()) { + String customName = armorStand.getCustomNameTag(); + if(customName.equals(EnumChatFormatting.AQUA+"Travel to:")) { + travelToPositions.add(new Vector3f((float)armorStand.posX, (float)armorStand.posY, (float)armorStand.posZ)); + } + } + } + } + travelToPositions.removeAll(loadedPortals); + for(Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) { + if(entity instanceof EntityArmorStand) { + EntityArmorStand armorStand = (EntityArmorStand) entity; + if(armorStand.isInvisible() && armorStand.hasCustomName()) { + String customName = armorStand.getCustomNameTag(); + for(Vector3f position : travelToPositions) { + if(position.x == (float)armorStand.posX && position.y-0.375 == (float)armorStand.posY && position.z == (float)armorStand.posZ) { + float smallestDist = 999; + BlockPos closestPortal = null; + for(int xOff=-3; xOff<=3; xOff++) { + for(int zOff=-3; zOff<=3; zOff++) { + if(xOff != 0 && zOff != 0) continue; + BlockPos pos = new BlockPos(armorStand.posX+xOff, armorStand.posY+2, armorStand.posZ+zOff); + if(Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock() == Blocks.portal) { + float dist = (float)(armorStand.posX-(pos.getX()+0.5) + armorStand.posZ-(pos.getZ()+0.5)); + if(closestPortal == null || dist < smallestDist) { + smallestDist = dist; + closestPortal = pos; + } + } + } + } + if(closestPortal != null) { + portalNameMap.put(closestPortal, customName); + } + } + } + } + } + } + loadedPortals.addAll(travelToPositions); + } + } + + public void tryRegisterPortal() { + + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java index 9fcb218f..fb8671cb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java @@ -22,8 +22,13 @@ public class GuiTextures { public static final ResourceLocation slider_button = new ResourceLocation("notenoughupdates:slider_button.png"); public static final ResourceLocation item_mask = new ResourceLocation("notenoughupdates:item_mask.png"); + public static final ResourceLocation item_haschild = new ResourceLocation("notenoughupdates:item_haschild.png"); public static final ResourceLocation button_tex = new ResourceLocation("notenoughupdates:button.png"); + public static final ResourceLocation accessory_bag_overlay = new ResourceLocation("notenoughupdates:accessory_bag_overlay.png"); + + public static final ResourceLocation quickcommand_background = new ResourceLocation("notenoughupdates:quickcommand_background.png"); + public static final ResourceLocation gamemodes = new ResourceLocation("notenoughupdates:gamemodes.png"); public static final ResourceLocation radial_square_off = new ResourceLocation("notenoughupdates:radial_square_off.png"); public static final ResourceLocation radial_square_on = new ResourceLocation("notenoughupdates:radial_square_on.png"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java b/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java new file mode 100644 index 00000000..8ec4263a --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java @@ -0,0 +1,60 @@ +package io.github.moulberry.notenoughupdates; + +import io.github.moulberry.morus.MorusSubstitutor; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; + +import java.util.HashMap; +import java.util.Map; + +public class MorusIntegration { + + private static MorusIntegration INSTANCE = new MorusIntegration(); + + public static MorusIntegration getInstance() { + return INSTANCE; + } + + private HashMap itemDrops = null; + private HashMap inventoryItems = null; + + public void tick() { + if(itemDrops == null) { + itemDrops = new HashMap<>(); + for(String item : NotEnoughUpdates.INSTANCE.manager.getItemInformation().keySet()) { + itemDrops.put(item, 0); + } + } + + HashMap newInventoryItems = getInventoryItems(); + if(inventoryItems != null) { + for(String internal : newInventoryItems.keySet()) { + int newAmount = newInventoryItems.get(internal); + int oldAmount = inventoryItems.getOrDefault(internal, 0); + if(newAmount > oldAmount) { + itemDrops.put(internal, itemDrops.getOrDefault(internal, 0)+newAmount-oldAmount); + } + } + } + inventoryItems = newInventoryItems; + + for(Map.Entry entry : itemDrops.entrySet()) { + MorusSubstitutor.putSubstiution("notenoughupdates", "itemdrops."+entry.getKey().toLowerCase(), ""+entry.getValue()); + } + + } + + public HashMap getInventoryItems() { + HashMap inventoryItems = new HashMap<>(); + if(Minecraft.getMinecraft().thePlayer != null) { + for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { + String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); + if(internalname != null) { + inventoryItems.put(internalname, inventoryItems.getOrDefault(internalname, 0)+stack.stackSize); + } + } + } + return inventoryItems; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index fb6348ee..95eefef5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -32,6 +32,7 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.*; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -136,7 +137,15 @@ public class NEUEventListener { if(longUpdate) { neu.updateSkyblockScoreboard(); CapeManager.getInstance().tick(); + + if(!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) { + AccessoryBagOverlay.resetCache(); + } + if(neu.hasSkyblockScoreboard()) { + if(Loader.isModLoaded("morus")) { + MorusIntegration.getInstance().tick(); + } lastSkyblockScoreboard = currentTime; if(!joinedSB) { joinedSB = true; @@ -173,8 +182,8 @@ public class NEUEventListener { } if(longUpdate && neu.hasSkyblockScoreboard()) { if(neu.manager.getCurrentProfile() == null || neu.manager.getCurrentProfile().length() == 0) { - ProfileViewer.Profile profile = neu.profileViewer.getProfile( - Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""), (json) -> {}); + ProfileViewer.Profile profile = neu.profileViewer.getProfile(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""), + callback->{}); if(profile != null) { String latest = profile.getLatestProfile(); if(latest != null) { @@ -276,6 +285,7 @@ public class NEUEventListener { @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { neu.manager.auctionManager.customAH.lastGuiScreenSwitch = System.currentTimeMillis(); + BetterContainers.reset(); if(event.gui == null && neu.manager.auctionManager.customAH.isRenderOverAuctionView() && !(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui)) { @@ -511,6 +521,7 @@ public class NEUEventListener { if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) { renderDungeonChestOverlay(event.gui); + AccessoryBagOverlay.renderOverlay(); } } @@ -748,12 +759,16 @@ public class NEUEventListener { return; } if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) { - if(!(hoverInv && focusInv)) { - if(neu.overlay.mouseInput()) { - event.setCanceled(true); - } + if(AccessoryBagOverlay.mouseClick()) { + event.setCanceled(true); } else { - neu.overlay.mouseInputInv(); + if(!(hoverInv && focusInv)) { + if(neu.overlay.mouseInput()) { + event.setCanceled(true); + } + } else { + neu.overlay.mouseInputInv(); + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index a3670a86..49a886b6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -8,8 +8,8 @@ import io.github.moulberry.notenoughupdates.infopanes.*; import io.github.moulberry.notenoughupdates.itemeditor.NEUItemEditor; import io.github.moulberry.notenoughupdates.mbgui.MBAnchorPoint; import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement; +import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating; -import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupHorz; import io.github.moulberry.notenoughupdates.util.LerpingFloat; import io.github.moulberry.notenoughupdates.util.LerpingInteger; import io.github.moulberry.notenoughupdates.util.Utils; @@ -96,6 +96,13 @@ public class NEUOverlay extends Gui { private TreeSet searchedItems = null; private JsonObject[] searchedItemsArr = null; + private HashMap> searchedItemsSubgroup = new HashMap<>(); + + private long selectedItemMillis = 0; + private int selectedItemGroupX = -1; + private int selectedItemGroupY = -1; + private List selectedItemGroup = null; + private boolean itemPaneOpen = false; private int page = 0; @@ -272,20 +279,17 @@ public class NEUOverlay extends Gui { @Override public void render(float x, float y) { int paddingUnscaled = getPaddingUnscaled(); + int searchYSize = getSearchBarYSize(); - Minecraft.getMinecraft().getTextureManager().bindTexture(settings); - drawRect((int)x, (int)y, - (int)x + getWidth(), (int)y + getHeight(), - Color.WHITE.getRGB()); - - - drawRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, - (int)x + getWidth() - paddingUnscaled, (int)y + getHeight() - paddingUnscaled, - Color.GRAY.getRGB()); + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(x, y, + searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + Minecraft.getMinecraft().getTextureManager().bindTexture(settings); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, - getSearchBarYSize(), getSearchBarYSize()); + searchYSize, searchYSize); GlStateManager.bindTexture(0); } }; @@ -324,16 +328,14 @@ public class NEUOverlay extends Gui { @Override public void render(float x, float y) { int paddingUnscaled = getPaddingUnscaled(); + int searchYSize = getSearchBarYSize(); - Minecraft.getMinecraft().getTextureManager().bindTexture(help); - drawRect((int)x, (int)y, - (int)x + getWidth(), (int)y + getHeight(), - Color.WHITE.getRGB()); - - drawRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, - (int)x + getWidth() - paddingUnscaled, (int)y + getHeight() - paddingUnscaled, - Color.GRAY.getRGB()); + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(x, y, + searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + Minecraft.getMinecraft().getTextureManager().bindTexture(help); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize()); @@ -402,7 +404,6 @@ public class NEUOverlay extends Gui { NBTTagList textures = new NBTTagList(); NBTTagCompound textures_0 = new NBTTagCompound(); - String uuid = UUID.nameUUIDFromBytes(display.getBytes()).toString(); skullOwner.setString("Id", uuid); skullOwner.setString("Name", uuid); @@ -425,13 +426,10 @@ public class NEUOverlay extends Gui { } } if(render != null) { - Minecraft.getMinecraft().getTextureManager().bindTexture(item_mask); + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - bigItemSize + paddingUnscaled*2, bigItemSize + paddingUnscaled*2, GL11.GL_LINEAR); - GlStateManager.color(fg.getRed() / 255f,fg.getGreen() / 255f, - fg.getBlue() / 255f, fg.getAlpha() / 255f); - Utils.drawTexturedRect(x+paddingUnscaled, y+paddingUnscaled, bigItemSize, bigItemSize, GL11.GL_LINEAR); + bigItemSize + paddingUnscaled*2, bigItemSize + paddingUnscaled*2, GL11.GL_NEAREST); int mouseX = Mouse.getX() * scaledresolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth; int mouseY = scaledresolution.getScaledHeight() - Mouse.getY() * scaledresolution.getScaledHeight() / Minecraft.getMinecraft().displayHeight - 1; @@ -455,21 +453,21 @@ public class NEUOverlay extends Gui { }; } - private MBGuiGroupHorz createQuickCommandGroup() { + private MBGuiGroupAligned createQuickCommandGroup() { List children = new ArrayList<>(); for(String quickCommand : manager.config.quickCommands.value) { children.add(createQuickCommand(quickCommand)); } - return new MBGuiGroupHorz(children) { + return new MBGuiGroupAligned(children, false) { public int getPadding() { return getPaddingUnscaled()*4; } }; } - private MBGuiGroupHorz createSearchBarGroup() { + private MBGuiGroupAligned createSearchBarGroup() { List children = Lists.newArrayList(createSettingsButton(this), createSearchBar(), createHelpButton(this)); - return new MBGuiGroupHorz(children) { + return new MBGuiGroupAligned(children, false) { public int getPadding() { return getPaddingUnscaled()*4; } @@ -619,6 +617,29 @@ public class NEUOverlay extends Gui { guiGroup.mouseClick(0, 0, mouseX, mouseY); + if(selectedItemGroup != null) { + int selectedX = Math.min(selectedItemGroupX, width-getBoxPadding()-18*selectedItemGroup.size()); + if(mouseY > selectedItemGroupY+17 && mouseY < selectedItemGroupY+35) { + for(int i=0; i= selectedX-1+18*i && mouseX <= selectedX+17+18*i) { + JsonObject item = selectedItemGroup.get(i); + if (item != null) { + if(Mouse.getEventButton() == 0) { + manager.showRecipe(item); + } else if(Mouse.getEventButton() == 1) { + showInfo(item); + } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + textField.setText("id:"+item.get("internalname").getAsString()); + updateSearch(); + searchMode = true; + } + } + return true; + } + } + } + } + //Item selection (right) gui if(mouseX > width*getItemPaneOffsetFactor()) { if(!Mouse.getEventButtonState()) return true; //End early if the mouse isn't pressed, but still cancel event. @@ -1076,13 +1097,31 @@ public class NEUOverlay extends Gui { public void updateSearch() { if(searchedItems==null) searchedItems = new TreeSet<>(getItemComparator()); searchedItems.clear(); + searchedItemsSubgroup.clear(); searchedItemsArr = null; redrawItems = true; Set itemsMatch = manager.search(textField.getText(), true); for(String itemname : itemsMatch) { JsonObject item = manager.getItemInformation().get(itemname); if(checkMatchesSort(itemname, item)) { - searchedItems.add(item); + if(item.has("parent") && item.get("parent").isJsonPrimitive()) { + searchedItemsSubgroup + .computeIfAbsent(item.get("parent").getAsString(), k->new HashSet<>()) + .add(item.get("internalname").getAsString()); + } else { + searchedItems.add(item); + } + } + } + out: + for(Map.Entry> entry : searchedItemsSubgroup.entrySet()) { + if(searchedItems.contains(manager.getItemInformation().get(entry.getKey()))) { + continue; + } + for(String itemname : entry.getValue()) { + JsonObject item = manager.getItemInformation().get(itemname); + System.out.println("searching "+itemname); + if(item != null) searchedItems.add(item); } } switch(textField.getText().toLowerCase().trim()) { @@ -1741,6 +1780,18 @@ public class NEUOverlay extends Gui { millisLastMouseMove = System.currentTimeMillis(); } + if(selectedItemGroup != null) { + if(mouseX < selectedItemGroupX-1 || mouseX > selectedItemGroupX+17 || + mouseY < selectedItemGroupY-1 || mouseY > selectedItemGroupY+17) { + int selectedX = Math.min(selectedItemGroupX, width-getBoxPadding()-18*selectedItemGroup.size()); + if(mouseX < selectedX-1 || mouseX > selectedX-1+18*selectedItemGroup.size() || + mouseY < selectedItemGroupY+17 || mouseY > selectedItemGroupY+35) { + selectedItemGroup = null; + selectedItemMillis = -1; + } + } + } + if(!hoverInv) { iterateItemSlots(new ItemSlotConsumer() { public void consume(int x, int y, int id) { @@ -1750,7 +1801,25 @@ public class NEUOverlay extends Gui { } if (mouseX > x - 1 && mouseX < x + ITEM_SIZE + 1) { if (mouseY > y - 1 && mouseY < y + ITEM_SIZE + 1) { - tooltipToDisplay.set(json); + String internalname = json.get("internalname").getAsString(); + if(searchedItemsSubgroup.containsKey(internalname)) { + if(selectedItemMillis == -1) selectedItemMillis = System.currentTimeMillis(); + if(System.currentTimeMillis() - selectedItemMillis > 200 && + (selectedItemGroup == null || selectedItemGroup.isEmpty())) { + + ArrayList children = new ArrayList<>(); + children.add(json); + for(String itemname : searchedItemsSubgroup.get(internalname)) { + children.add(manager.getItemInformation().get(itemname)); + } + + selectedItemGroup = children; + selectedItemGroupX = x; + selectedItemGroupY = y; + } + } else { + tooltipToDisplay.set(json); + } } } } @@ -1775,6 +1844,38 @@ public class NEUOverlay extends Gui { renderItems(xStart, true, true, true); } + if(selectedItemGroup != null) { + GL11.glTranslatef(0, 0, 10); + + int selectedX = Math.min(selectedItemGroupX, width-getBoxPadding()-18*selectedItemGroup.size()); + + GlStateManager.depthFunc(GL11.GL_LESS); + drawRect(selectedX, selectedItemGroupY+18, + selectedX-2+18*selectedItemGroup.size(), selectedItemGroupY+34, fgCustomOpacity.getRGB()); + drawRect(selectedX, selectedItemGroupY+18, + selectedX-1+18*selectedItemGroup.size(), selectedItemGroupY+35, new Color(30, 30, 30).getRGB()); + drawRect(selectedX-1, selectedItemGroupY+17, + selectedX-2+18*selectedItemGroup.size(), selectedItemGroupY+34, new Color(180, 180, 180).getRGB()); + GlStateManager.depthFunc(GL11.GL_LEQUAL); + + GL11.glTranslatef(0, 0, 10); + + tooltipToDisplay.set(null); + if(mouseY > selectedItemGroupY+17 && mouseY < selectedItemGroupY+35) { + for(int i=0; i= selectedX-1+18*i && mouseX <= selectedX+17+18*i) { + tooltipToDisplay.set(selectedItemGroup.get(i)); + } + } + } + for(int i=0; i3?(wolf>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; EnumChatFormatting avgPrefix = avgSkillLVL>20?(avgSkillLVL>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - overallScore += combat*combat/2000f; overallScore += zombie*zombie/81f; overallScore += spider*spider/81f; overallScore += wolf*wolf/81f; overallScore += avgSkillLVL/20f; - - int cata = profile.getDungeonCatacombsLevel(null); + int cata = (int)Utils.getElementAsFloat(skill.get("level_skill_catacombs"), 0); EnumChatFormatting cataPrefix = cata>15?(cata>25?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + overallScore += cata*cata/2000f; + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( g+"Combat: "+combatPrefix+(int)Math.floor(combat) + (cata > 0 ? g+" - Cata: "+cataPrefix+cata : "")+ @@ -610,6 +610,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(CapeManager.getInstance()); MinecraftForge.EVENT_BUS.register(new SBGamemodes()); MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE); + //MinecraftForge.EVENT_BUS.register(new BetterPortals()); File f = new File(event.getModConfigurationDirectory(), "notenoughupdates"); f.mkdirs(); @@ -724,7 +725,6 @@ public class NotEnoughUpdates { ChatComponentText github = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"GitHub"+EnumChatFormatting.GRAY+"]"); github.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, github_link)); - links.appendSibling(separator); links.appendSibling(discord); links.appendSibling(separator); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java b/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java index 2a19b16e..d9e9217a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java @@ -38,13 +38,13 @@ public class SBAIntegration { skyblockAddons_getUtils = skyblockAddonsClass.getDeclaredMethod("getUtils"); } if(backpackManagerClass == null) { - backpackManagerClass = Class.forName("codes.biscuit.skyblockaddons.utils.BackpackManager"); + backpackManagerClass = Class.forName("codes.biscuit.skyblockaddons.features.backpacks.BackpackManager"); } if(backpackManager_getFromItem == null) { backpackManager_getFromItem = backpackManagerClass.getDeclaredMethod("getFromItem", ItemStack.class); } if(backpackClass == null) { - backpackClass = Class.forName("codes.biscuit.skyblockaddons.utils.Backpack"); + backpackClass = Class.forName("codes.biscuit.skyblockaddons.features.backpacks.Backpack"); } if(backpackClass_setX == null) { backpackClass_setX = backpackClass.getDeclaredMethod("setX", int.class); @@ -74,7 +74,10 @@ public class SBAIntegration { backpackClass_setY.invoke(backpack, mouseY); utils_setBackpackToPreview.invoke(utils, backpack); } - } catch(Exception e) { return false; } + } catch(Exception e) { + e.printStackTrace(); + return false; + } return true; } @@ -97,6 +100,7 @@ public class SBAIntegration { try { return (boolean) guiContainerHook_freezeBackpack.get(null); } catch(Exception e) { + e.printStackTrace(); return false; } } @@ -120,6 +124,7 @@ public class SBAIntegration { guiContainerHook_freezeBackpack.set(null, freezeBackpack); return true; } catch(Exception e) { + e.printStackTrace(); return false; } } @@ -156,7 +161,10 @@ public class SBAIntegration { } else { guiContainerHook_keyTyped.invoke(null, keyCode); } - } catch(Exception e) { return false; } + } catch(Exception e) { + e.printStackTrace(); + return false; + } return true; } @@ -193,7 +201,10 @@ public class SBAIntegration { guiContainerHook_drawBackpacks.invoke(null, container, mouseX, mouseY, fontRendererObj); } - } catch(Exception e) { return false; } + } catch(Exception e) { + e.printStackTrace(); + return false; + } return true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java index 1669d617..6bdf2c5d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java @@ -58,6 +58,7 @@ public class TradeWindow { private static int lastBackpackY; public static boolean tradeWindowActive() { + if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false; if(!NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.value) return false; GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; @@ -110,14 +111,17 @@ public class TradeWindow { StringBuilder sb = new StringBuilder(); for(int index = 0; index < clean.length(); index++) { char c = clean.charAt(index); - if("0123456789".indexOf(c) >= 0) { + if("0123456789.".indexOf(c) >= 0) { sb.append(c); } else { switch(c) { + case 'K': case 'k': mult = 1000; break; + case 'M': case 'm': mult = 1000000; break; + case 'B': case 'b': mult = 1000000000; break; default: @@ -127,7 +131,7 @@ public class TradeWindow { } } try { - int coins = Integer.parseInt(sb.toString())*mult; + int coins = (int)(Float.parseFloat(sb.toString())*mult); topItemsStack.putIfAbsent("TRADE_COINS", stack); @@ -318,14 +322,17 @@ public class TradeWindow { StringBuilder sb = new StringBuilder(); for(int index = 0; index < clean.length(); index++) { char c = clean.charAt(index); - if("0123456789".indexOf(c) >= 0) { + if("0123456789.".indexOf(c) >= 0) { sb.append(c); } else { switch(c) { + case 'K': case 'k': mult = 1000; break; + case 'M': case 'm': mult = 1000000; break; + case 'B': case 'b': mult = 1000000000; break; default: @@ -335,7 +342,7 @@ public class TradeWindow { } } try { - int coins = Integer.parseInt(sb.toString())*mult; + int coins = (int)(Float.parseFloat(sb.toString())*mult); List list = ourTradeMap.computeIfAbsent(coins, k -> new ArrayList<>()); list.add(containerIndex); @@ -413,14 +420,17 @@ public class TradeWindow { StringBuilder sb = new StringBuilder(); for(int index = 0; index < clean.length(); index++) { char c = clean.charAt(index); - if("0123456789".indexOf(c) >= 0) { + if("0123456789.".indexOf(c) >= 0) { sb.append(c); } else { switch(c) { + case 'K': case 'k': mult = 1000; break; + case 'M': case 'm': mult = 1000000; break; + case 'B': case 'b': mult = 1000000000; break; default: @@ -430,7 +440,7 @@ public class TradeWindow { } } try { - int coins = Integer.parseInt(sb.toString())*mult; + int coins = (int)(Float.parseFloat(sb.toString())*mult); List list = theirTradeMap.computeIfAbsent(coins, k -> new ArrayList<>()); list.add(containerIndex); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index 82b33611..03796993 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -25,6 +25,7 @@ import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; public class APIManager { @@ -188,7 +189,7 @@ public class APIManager { lastBazaarUpdate = currentTime; updateBazaar(); } - if(currentTime - lastCleanup > 120*1000) { + if(currentTime - lastCleanup > 60*1000) { lastCleanup = currentTime; cleanup(); } @@ -326,14 +327,8 @@ public class APIManager { getPageFromAPI(0); } - manager.hypixelApi.getMyApiGZIPAsync("auction.json.gz", jsonObject -> { + Consumer process = jsonObject -> { if(jsonObject.get("success").getAsBoolean()) { - long apiUpdate = (long)jsonObject.get("time").getAsFloat(); - if(lastApiUpdate == apiUpdate) { - lastAuctionUpdate -= 30*1000; - } - lastApiUpdate = apiUpdate; - JsonArray new_auctions = jsonObject.get("new_auctions").getAsJsonArray(); for(JsonElement auctionElement : new_auctions) { JsonObject auction = auctionElement.getAsJsonObject(); @@ -365,9 +360,26 @@ public class APIManager { } remove(toRemove); } - }, () -> { + }; + + manager.hypixelApi.getMyApiGZIPAsync("auctionLast.json.gz", process, () -> { System.out.println("Error downloading auction from Moulberry's jank API. :("); }); + + manager.hypixelApi.getMyApiGZIPAsync("auction.json.gz", jsonObject -> { + if(jsonObject.get("success").getAsBoolean()) { + long apiUpdate = (long) jsonObject.get("time").getAsFloat(); + if (lastApiUpdate == apiUpdate) { + lastAuctionUpdate -= 30 * 1000; + } + lastApiUpdate = apiUpdate; + + process.accept(jsonObject); + } + }, () -> { + System.out.println("Error downloading auction from Moulberry's jank API. :("); + }); + } public void calculateStats() { @@ -503,7 +515,7 @@ public class APIManager { int count = item_tag.getInteger("Count"); int price = starting_bid/(count>0?count:1); lowestBINs.computeIfAbsent(price, k -> new HashSet<>()).add(auctionUuid); - if(lowestBINs.size() > 10) { + if(lowestBINs.size() > 50) { lowestBINs.keySet().remove(lowestBINs.lastKey()); } } @@ -640,6 +652,15 @@ public class APIManager { }, () -> {}); } + public Set getItemAuctionInfoKeySet() { + if(auctionPricesJson == null) return new HashSet<>(); + HashSet keys = new HashSet<>(); + for(Map.Entry entry : auctionPricesJson.entrySet()) { + keys.add(entry.getKey()); + } + return keys; + } + public JsonObject getItemAuctionInfo(String internalname) { if(auctionPricesJson == null) return null; JsonElement e = auctionPricesJson.get(internalname); @@ -660,26 +681,18 @@ public class APIManager { private static final List hardcodedVanillaItems = Utils.createList( "WOOD_AXE", "WOOD_HOE", "WOOD_PICKAXE","WOOD_SPADE", "WOOD_SWORD", - "GOLD_AXE", "GOLD_HOE", "GOLD_PICKAXE", "GOLD_SPADE", "GOLD_SWORD" + "GOLD_AXE", "GOLD_HOE", "GOLD_PICKAXE", "GOLD_SPADE", "GOLD_SWORD", + "ROOKIE_HOE" ); public boolean isVanillaItem(String internalname) { if(hardcodedVanillaItems.contains(internalname)) return true; //Removes trailing numbers and underscores, eg. LEAVES_2-3 -> LEAVES String vanillaName = internalname.split("-")[0]; - int sub = 0; - for(int i=vanillaName.length()-1; i>1; i--) { - char c = vanillaName.charAt(i); - if((int)c >= 48 && (int)c <= 57) { //0-9 - sub++; - } else if(c == '_') { - sub++; - break; - } else { - break; - } + if(manager.getItemInformation().containsKey(vanillaName)) { + JsonObject json = manager.getItemInformation().get(vanillaName); + if(json != null && json.has("vanilla") && json.get("vanilla").getAsBoolean()) return true; } - vanillaName = vanillaName.substring(0, vanillaName.length()-sub).toLowerCase(); return Item.itemRegistry.getObject(new ResourceLocation(vanillaName)) != null; } @@ -689,10 +702,14 @@ public class APIManager { public float craftCost = -1; } + public CraftInfo getCraftCost(String internalname) { + return getCraftCost(internalname, 0); + } + /** * Recursively calculates the cost of crafting an item from raw materials. */ - public CraftInfo getCraftCost(String internalname) { + public CraftInfo getCraftCost(String internalname, int depth) { if(craftCost.containsKey(internalname)) { return craftCost.get(internalname); } else { @@ -714,6 +731,12 @@ public class APIManager { ci.craftCost = auctionPrice; } } + + if(depth > 16) { + craftCost.put(internalname, ci); + return ci; + } + JsonObject item = manager.getItemInformation().get(internalname); if(item != null && item.has("recipe")) { float craftPrice = 0; @@ -731,7 +754,12 @@ public class APIManager { count = Integer.parseInt(itemS.split(":")[1]); itemS = itemS.split(":")[0]; } - float compCost = getCraftCost(itemS).craftCost * count; + if(itemS.equals(internalname)) { //if item is used a crafting component in its own recipe, return + craftCost.put(internalname, ci); + return ci; + } + + float compCost = getCraftCost(itemS, depth+1).craftCost * count; if(compCost < 0) { //If it's a custom item without a cost, return if(!getCraftCost(itemS).vanillaItem) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index 06211f59..f23b87fd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -87,8 +87,8 @@ public class CustomAH extends Gui { private float scrollAmount; - public int guiLeft = 0; - public int guiTop = 0; + public int guiLeft = -1; + public int guiTop = -1; private Category CATEGORY_SWORD = new Category("sword", "Swords", "diamond_sword"); private Category CATEGORY_ARMOR = new Category("armor", "Armor", "diamond_chestplate"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java index ec5f8209..22427cee 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java @@ -4,10 +4,25 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NEUOverlay; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; import org.lwjgl.input.Keyboard; +import java.io.IOException; import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -45,7 +60,8 @@ public class DevInfoPane extends TextInfoPane { }*/ //if(true) return text; - for(String internalname : manager.auctionManager.internalnameToAucIdMap.keySet()) { + for(String internalname : manager.auctionManager.getItemAuctionInfoKeySet()) { + if(internalname.contains("-")) continue; if(!manager.getItemInformation().containsKey(internalname)) { text += internalname + "\n"; } @@ -69,12 +85,852 @@ public class DevInfoPane extends TextInfoPane { AtomicBoolean running = new AtomicBoolean(false); ScheduledExecutorService ses = Executors.newScheduledThreadPool(1); + String[] bukkitList = new String[] { + "ACACIA_DOOR_ITEM", + "ACACIA_FENCE", + "ACACIA_FENCE_GATE", + "ACACIA_STAIRS", + "ACTIVATOR_RAIL", + "ANVIL", + "APPLE", + "ARMOR_STAND", + "ARROW", + "BAKED_POTATO", + "BANNER", + "BARRIER", + "BEACON", + "BED", + "BEDROCK", + "BIRCH_DOOR_ITEM", + "BIRCH_FENCE", + "BIRCH_FENCE_GATE", + "BIRCH_WOOD_STAIRS@birch_stairs", + "BLAZE_POWDER", + "BLAZE_ROD", + "BOAT", + "BONE", + "BOOK", + "BOOK_AND_QUILL@writable_book", + "BOOKSHELF", + "BOW", + "BOWL", + "BREAD", + "BREWING_STAND_ITEM", + "BRICK@brick_block", + "BRICK_STAIRS", + "BROWN_MUSHROOM", + "BUCKET", + "CACTUS", + "CAKE", + "CARPET", + "CARROT_ITEM", + "CARROT_STICK@carrot_on_a_stick", + "CAULDRON_ITEM", + "CHAINMAIL_BOOTS", + "CHAINMAIL_CHESTPLATE", + "CHAINMAIL_HELMET", + "CHAINMAIL_LEGGINGS", + "CHEST", + "CLAY", + "CLAY_BALL", + "CLAY_BRICK@brick", + "COAL", + "COAL_BLOCK", + "COAL_ORE", + "COBBLE_WALL@cobblestone_wall", + "COBBLESTONE", + "COBBLESTONE_STAIRS@stone_stairs", + "COMMAND@command_block", + "COMMAND_MINECART@command_block_minecart", + "COMPASS", + "COOKED_BEEF", + "COOKED_CHICKEN", + "COOKED_FISH", + "COOKED_MUTTON", + "COOKED_RABBIT", + "COOKIE", + "DARK_OAK_DOOR_ITEM", + "DARK_OAK_FENCE", + "DARK_OAK_FENCE_GATE", + "DARK_OAK_STAIRS", + "DAYLIGHT_DETECTOR", + "DEAD_BUSH@deadbush", + "DETECTOR_RAIL", + "DIAMOND", + "DIAMOND_AXE", + "DIAMOND_BARDING@diamond_horse_armor", + "DIAMOND_BLOCK", + "DIAMOND_BOOTS", + "DIAMOND_CHESTPLATE", + "DIAMOND_HELMET", + "DIAMOND_HOE", + "DIAMOND_LEGGINGS", + "DIAMOND_ORE", + "DIAMOND_PICKAXE", + "DIAMOND_SPADE@diamond_shovel", + "DIAMOND_SWORD", + "DIODE@repeater", + "DIRT", + "DISPENSER", + "DOUBLE_PLANT", + "DRAGON_EGG", + "DROPPER", + "EGG", + "EMERALD", + "EMERALD_BLOCK", + "EMERALD_ORE", + "EMPTY_MAP@map", + "ENCHANTED_BOOK", + "ENCHANTMENT_TABLE@enchanting_table", + "ENDER_CHEST", + "ENDER_PEARL", + "ENDER_PORTAL_FRAME@end_portal_frame", + "ENDER_STONE@end_stone", + "EXP_BOTTLE@experience_bottle", + "EXPLOSIVE_MINECART@tnt_minecart", + "EYE_OF_ENDER@ender_eye", + "FEATHER", + "FENCE", + "FENCE_GATE", + "FERMENTED_SPIDER_EYE", + "FIREBALL@fire_charge", + "FIREWORK@fireworks", + "FIREWORK_CHARGE", + "FISHING_ROD", + "FLINT", + "FLINT_AND_STEEL", + "FLOWER_POT_ITEM", + "FURNACE", + "GHAST_TEAR", + "GLASS", + "GLASS_BOTTLE", + "GLOWSTONE", + "GLOWSTONE_DUST", + "GOLD_AXE@golden_axe", + "GOLD_BARDING@golden_horse_armor", + "GOLD_BLOCK", + "GOLD_BOOTS@golden_boots", + "GOLD_CHESTPLATE@golden_chestplate", + "GOLD_HELMET@golden_helmet", + "GOLD_HOE@golden_hoe", + "GOLD_INGOT", + "GOLD_LEGGINGS@golden_leggings", + "GOLD_NUGGET", + "GOLD_ORE", + "GOLD_PICKAXE@golden_pickaxe", + "GOLD_PLATE@light_weighted_pressure_plate", + "GOLD_RECORD@record_13", + "GOLD_SPADE@golden_shovel", + "GOLD_SWORD@golden_sword", + "GOLDEN_APPLE", + "GOLDEN_CARROT", + "GRASS", + "GRAVEL", + "GREEN_RECORD@record_cat", + "GRILLED_PORK@cooked_porkchop", + "HARD_CLAY@hardened_clay", + "HAY_BLOCK", + "HOPPER", + "HOPPER_MINECART", + "ICE", + "INK_SACK@dye", + "IRON_AXE", + "IRON_BARDING@iron_horse_armor", + "IRON_BLOCK", + "IRON_BOOTS", + "IRON_CHESTPLATE", + "IRON_DOOR", + "IRON_FENCE@iron_bars", + "IRON_HELMET", + "IRON_HOE", + "IRON_INGOT", + "IRON_LEGGINGS", + "IRON_ORE", + "IRON_PICKAXE", + "IRON_PLATE@heavy_weighted_pressure_plate", + "IRON_SPADE@iron_shovel", + "IRON_SWORD", + "IRON_TRAPDOOR", + "ITEM_FRAME", + "JACK_O_LANTERN@lit_pumpkin", + "JUKEBOX", + "JUNGLE_DOOR_ITEM", + "JUNGLE_FENCE", + "JUNGLE_FENCE_GATE", + "JUNGLE_WOOD_STAIRS@jungle_stairs", + "LADDER", + "LAPIS_BLOCK", + "LAPIS_ORE", + "LAVA_BUCKET", + "LEASH@lead", + "LEATHER", + "LEATHER_BOOTS", + "LEATHER_CHESTPLATE", + "LEATHER_HELMET", + "LEATHER_LEGGINGS", + "LEAVES", + "LEAVES_2@leaves2", + "LEVER", + "LOG", + "LOG_2@log2", + "LONG_GRASS@tallgrass", + "MAGMA_CREAM", + "MAP", + "MELON", + "MELON_BLOCK", + "MELON_SEEDS", + "MILK_BUCKET", + "MINECART", + "MOB_SPAWNER", + "MONSTER_EGG", + "MONSTER_EGGS@spawn_egg", + "MOSSY_COBBLESTONE", + "MUSHROOM_SOUP@mushroom_stew", + "MUTTON", + "MYCEL@mycelium", + "NAME_TAG", + "NETHER_BRICK", + "NETHER_BRICK_ITEM", + "NETHER_BRICK_STAIRS", + "NETHER_FENCE@nether_brick_fence", + "NETHER_STAR", + "NETHER_WARTS@nether_wart", + "NETHERRACK", + "NOTE_BLOCK@noteblock", + "OBSIDIAN", + "PACKED_ICE", + "PAINTING", + "PAPER", + "PISTON_BASE@piston", + "PISTON_STICKY_BASE@sticky_piston", + "POISONOUS_POTATO", + "PORK@porkchop", + "POTATO_ITEM", + "POTION", + "POWERED_MINECART@furnace_minecart", + "POWERED_RAIL@golden_rail", + "PRISMARINE", + "PRISMARINE_CRYSTALS", + "PRISMARINE_SHARD", + "PUMPKIN", + "PUMPKIN_PIE", + "PUMPKIN_SEEDS", + "QUARTZ", + "QUARTZ_BLOCK", + "QUARTZ_ORE", + "QUARTZ_STAIRS", + "RABBIT", + "RABBIT_FOOT", + "RABBIT_HIDE", + "RABBIT_STEW", + "RAILS@rail", + "RAW_BEEF@beef", + "RAW_CHICKEN@chicken", + "RAW_FISH@fish", + "RECORD_10@record_ward", + "RECORD_11", + "RECORD_12@record_wait", + "RECORD_3@record_blocks", + "RECORD_4@record_chirp", + "RECORD_5@record_far", + "RECORD_6@record_mall", + "RECORD_7@record_mellohi", + "RECORD_8@record_stal", + "RECORD_9@record_strad", + "RED_MUSHROOM", + "RED_ROSE@red_flower", + "RED_SANDSTONE", + "RED_SANDSTONE_STAIRS", + "REDSTONE", + "REDSTONE_BLOCK", + "REDSTONE_COMPARATOR@comparator", + "REDSTONE_LAMP_OFF@redstone_lamp", + "REDSTONE_ORE", + "REDSTONE_TORCH_ON@redstone_torch", + "ROTTEN_FLESH", + "SADDLE", + "SAND", + "SANDSTONE", + "SANDSTONE_STAIRS", + "SAPLING", + "SEA_LANTERN", + "SEEDS@wheat_seeds", + "SHEARS", + "SIGN", + "SKULL_ITEM", + "SLIME_BALL", + "SLIME_BLOCK@slime", + "SMOOTH_BRICK@stonebrick", + "SMOOTH_STAIRS@stone_brick_stairs", + "SNOW@snow_layer", + "SNOW_BALL@snowball", + "SNOW_BLOCK@snow", + "SOUL_SAND", + "SPECKLED_MELON", + "SPIDER_EYE", + "SPONGE", + "SPRUCE_DOOR_ITEM", + "SPRUCE_FENCE", + "SPRUCE_FENCE_GATE", + "SPRUCE_WOOD_STAIRS@spruce_stairs", + "STAINED_CLAY@stained_hardened_clay", + "STAINED_GLASS", + "STAINED_GLASS_PANE", + "STEP@stone_slab", + "STICK", + "STONE", + "STONE_AXE", + "STONE_BUTTON", + "STONE_HOE", + "STONE_PICKAXE", + "STONE_PLATE@stone_pressure_plate", + "STONE_SLAB2", + "STONE_SPADE@stone_shovel", + "STONE_SWORD", + "STORAGE_MINECART@chest_minecart", + "STRING", + "SUGAR", + "SUGAR_CANE@reeds", + "SULPHUR@gunpowder", + "THIN_GLASS@glass_pane", + "TNT", + "TORCH", + "TRAP_DOOR@trapdoor", + "TRAPPED_CHEST", + "TRIPWIRE_HOOK", + "VINE", + "WATCH@clock", + "WATER_BUCKET", + "WATER_LILY@waterlily", + "WEB", + "WHEAT", + "WOOD@planks", + "WOOD_AXE@wooden_axe", + "WOOD_BUTTON@wooden_button", + "WOOD_DOOR@wooden_door", + "WOOD_HOE@wooden_hoe", + "WOOD_PICKAXE@wooden_pickaxe", + "WOOD_PLATE@wooden_pressure_plate", + "WOOD_SPADE@wooden_shovel", + "WOOD_STAIRS@oak_stairs", + "WOOD_STEP@wooden_slab", + "WOOD_SWORD@wooden_sword", + "WOOL", + "WORKBENCH@crafting_table", + "WRITTEN_BOOK", + "YELLOW_FLOWER" + }; + + private void addStack(ItemStack stackToAdd, int depth) { + if(depth > 16) return; + + String regName2 = stackToAdd.getItem().getRegistryName().replace("minecraft:", ""); + String internalname = null; + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName2) || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName2))) { + internalname = bukkit2.split("@")[0]; + break; + } + } + if(internalname == null) return; + + if(stackToAdd.getItemDamage() != 0 && stackToAdd.getItemDamage() < 32000) { + internalname += "-" + stackToAdd.getItemDamage(); + } + + if(manager.getItemInformation().containsKey(internalname)) return; + + JsonObject recipeJson = null; + for(IRecipe recipe : CraftingManager.getInstance().getRecipeList()) { + ItemStack out = recipe.getRecipeOutput(); + if(out != null && out.getItem() == stackToAdd.getItem() && + (stackToAdd.getItemDamage() >= 32000 || out.getItemDamage() == stackToAdd.getItemDamage())) { + recipeJson = new JsonObject(); + + if (recipe instanceof ShapedRecipes) { + ShapedRecipes shaped = (ShapedRecipes) recipe; + + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + int recipeIndex = i-(3-shaped.recipeWidth)*yi; + if(xi < shaped.recipeWidth && recipeIndex < shaped.recipeItems.length) { + ItemStack stack = shaped.recipeItems[recipeIndex]; + if(stack != null) { + if(stack.getItem() != stackToAdd.getItem() || + (stackToAdd.getItemDamage() < 32000 && stack.getItemDamage() != stackToAdd.getItemDamage())) addStack(stack, depth+1); + + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + stacki += ":"+stack.stackSize; + } + } + } + + recipeJson.addProperty(y[yi]+x[xi], stacki); + } + break; + } else if(recipe instanceof ShapedOreRecipe) { + ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; + int width = (int)Utils.getField(ShapedOreRecipe.class, recipe, "width"); + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + int recipeIndex = i - (3 - width) * yi; + if (xi < width && recipeIndex < shaped.getRecipeSize()) { + ItemStack stack = null; + if(recipeIndex < shaped.getRecipeSize()) { + Object o = shaped.getInput()[recipeIndex]; + if(o instanceof ItemStack) { + stack = (ItemStack) o; + } else if(o instanceof List) { + for(Object o2 : (List)o) { + if(o2 instanceof ItemStack) { + stack = (ItemStack) o2; + break; + } + } + } + } + if(stack != null) { + if(stack.getItem() != stackToAdd.getItem() || + (stackToAdd.getItemDamage() < 32000 && stack.getItemDamage() != stackToAdd.getItemDamage())) addStack(stack, depth+1); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + } + + recipeJson.addProperty(y[yi]+x[xi], stacki); + } + } else if (recipe instanceof ShapelessRecipes) { + ShapelessRecipes shapeless = (ShapelessRecipes) recipe; + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + ItemStack stack = null; + if(i < shapeless.recipeItems.size()) { + stack = shapeless.recipeItems.get(i); + } + if(stack != null) { + if(stack.getItem() != stackToAdd.getItem() || + (stackToAdd.getItemDamage() < 32000 && stack.getItemDamage() != stackToAdd.getItemDamage())) addStack(stack, depth+1); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + + recipeJson.addProperty(y[yi]+x[xi], stacki); + } + break; + } else if (recipe instanceof ShapelessOreRecipe) { + ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + ItemStack stack = null; + if(i < shapeless.getRecipeSize()) { + Object o = shapeless.getInput().get(i);; + if(o instanceof ItemStack) { + stack = (ItemStack) o; + } else if(o instanceof List) { + for(Object o2 : (List)o) { + if(o2 instanceof ItemStack) { + stack = (ItemStack) o2; + break; + } + } + } + } + if(stack != null) { + if(stack.getItem() != stackToAdd.getItem() || + (stackToAdd.getItemDamage() < 32000 && stack.getItemDamage() != stackToAdd.getItemDamage())) addStack(stack, depth+1); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + + recipeJson.addProperty(y[yi]+x[xi], stacki); + } + break; + } + } + + } + ItemStack res = Utils.createItemStack(stackToAdd.getItem(), + EnumChatFormatting.WHITE+stackToAdd.getItem().getItemStackDisplayName(stackToAdd), + EnumChatFormatting.WHITE.toString()+EnumChatFormatting.BOLD+"COMMON"); + if(stackToAdd.getItemDamage() != 0 && stackToAdd.getItemDamage() < 32000) { + res.setItemDamage(stackToAdd.getItemDamage()); + } + res.getTagCompound().setInteger("HideFlags", 254); + NBTTagCompound ea = new NBTTagCompound(); + ea.setString("id", internalname); + res.getTagCompound().setTag("ExtraAttributes", ea); + + + JsonObject json = manager.getJsonForItem(res); + if(stackToAdd.getItemDamage() != 0 && stackToAdd.getItemDamage() < 32000) { + json.addProperty("parent", internalname.split("-")[0]); + } + + json.addProperty("internalname", internalname); + json.addProperty("modver", NotEnoughUpdates.VERSION); + json.addProperty("vanilla", true); + + if(recipeJson != null) { + json.add("recipe", recipeJson); + json.addProperty("clickcommand", "viewrecipe"); + } else { + json.addProperty("clickcommand", ""); + } + + json.addProperty("modver", NotEnoughUpdates.VERSION); + + try { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Added: " + internalname)); + manager.writeJsonDefaultDir(json, internalname+".json"); + manager.loadItem(internalname); + } catch(IOException e) {} + } + @Override public boolean keyboardInput() { + if(running.get() || true) return false; if(Keyboard.isKeyDown(Keyboard.KEY_J)) { running.set(!running.get()); - for(Map.Entry item : manager.getItemInformation().entrySet()) { + for(String bukkit : bukkitList) { + String internalname = bukkit.split("@")[0]; + if(true || !manager.getItemInformation().containsKey(internalname)) { + //System.out.println("adding vanilla: " + internalname); + String vanilla = internalname.toLowerCase().replace("_item", ""); + if(bukkit.contains("@")) { + vanilla = bukkit.split("@")[1]; + } + Item item = Item.itemRegistry.getObject(new ResourceLocation(vanilla)); + if(item == null) { + item = Item.getItemFromBlock(Block.blockRegistry.getObject(new ResourceLocation(vanilla))); + } + if(item != null) { + HashMap recipeJsonForDamage = new HashMap<>(); + for(IRecipe recipe : CraftingManager.getInstance().getRecipeList()) { + ItemStack out = recipe.getRecipeOutput(); + if(out != null && out.getItem() == item) { + System.out.println("Found recipe for : " + internalname + ":" + recipe); + JsonObject obj = new JsonObject(); + + if (recipe instanceof ShapedRecipes) { + ShapedRecipes shaped = (ShapedRecipes) recipe; + String[] x = {"1", "2", "3"}; + String[] y = {"A", "B", "C"}; + for (int i = 0; i < 9; i++) { + int xi = i % 3; + int yi = i / 3; + + String stacki = ""; + + int recipeIndex = i - (3 - shaped.recipeWidth) * yi; + if (xi < shaped.recipeWidth && recipeIndex < shaped.recipeItems.length) { + ItemStack stack = shaped.recipeItems[recipeIndex]; + if (stack != null) { + addStack(stack, 0); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for (String bukkit2 : bukkitList) { + if (bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName + "_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if (!stacki.isEmpty()) { + if (stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + } + + obj.addProperty(y[yi] + x[xi], stacki); + } + recipeJsonForDamage.put(out.getItemDamage() > 32000 ? 0 : out.getItemDamage(), obj); + } else if(recipe instanceof ShapedOreRecipe) { + ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; + int width = (int)Utils.getField(ShapedOreRecipe.class, recipe, "width"); + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + int recipeIndex = i - (3 - width) * yi; + if (xi < width && recipeIndex < shaped.getRecipeSize()) { + ItemStack stack = null; + if(recipeIndex < shaped.getRecipeSize()) { + Object o = shaped.getInput()[recipeIndex]; + if(o instanceof ItemStack) { + stack = (ItemStack) o; + } else if(o instanceof List) { + for(Object o2 : (List)o) { + if(o2 instanceof ItemStack) { + stack = (ItemStack) o2; + break; + } + } + } + } + if(stack != null) { + addStack(stack, 0); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + } + + obj.addProperty(y[yi]+x[xi], stacki); + } + recipeJsonForDamage.put(out.getItemDamage()>32000?0:out.getItemDamage(), obj); + } else if (recipe instanceof ShapelessRecipes) { + ShapelessRecipes shapeless = (ShapelessRecipes) recipe; + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + ItemStack stack = null; + if(i < shapeless.recipeItems.size()) { + stack = shapeless.recipeItems.get(i); + } + if(stack != null) { + addStack(stack, 0); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + + obj.addProperty(y[yi]+x[xi], stacki); + } + recipeJsonForDamage.put(out.getItemDamage() > 32000 ? 0 : out.getItemDamage(), obj); + break; + } else if (recipe instanceof ShapelessOreRecipe) { + ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; + String[] x = {"1","2","3"}; + String[] y = {"A","B","C"}; + for(int i=0; i<9; i++) { + int xi = i%3; + int yi = i/3; + + String stacki = ""; + + ItemStack stack = null; + if(i < shapeless.getRecipeSize()) { + Object o = shapeless.getInput().get(i);; + if(o instanceof ItemStack) { + stack = (ItemStack) o; + } else if(o instanceof List) { + for(Object o2 : (List)o) { + if(o2 instanceof ItemStack) { + stack = (ItemStack) o2; + break; + } + } + } + } + if(stack != null) { + addStack(stack, 0); + Item stackItem = stack.getItem(); + String regName = stackItem.getRegistryName().replace("minecraft:", ""); + for(String bukkit2 : bukkitList) { + if(bukkit2.equalsIgnoreCase(regName) || bukkit2.equalsIgnoreCase(regName+"_ITEM") || + (bukkit2.contains("@") && bukkit2.split("@")[1].equalsIgnoreCase(regName))) { + stacki = bukkit2.split("@")[0]; + break; + } + } + if(!stacki.isEmpty()) { + if(stack.getItemDamage() != 0 && stack.getItemDamage() < 32000) { + stacki += "-" + stack.getItemDamage(); + } + //stacki += ":"+stack.stackSize; + stacki += ":1"; + } + } + + obj.addProperty(y[yi]+x[xi], stacki); + } + recipeJsonForDamage.put(out.getItemDamage() > 32000 ? 0 : out.getItemDamage(), obj); + break; + } + } + } + + if(recipeJsonForDamage.isEmpty()) { + ItemStack res = Utils.createItemStack(item, + EnumChatFormatting.WHITE+item.getItemStackDisplayName(new ItemStack(item)), + EnumChatFormatting.WHITE.toString()+EnumChatFormatting.BOLD+"COMMON"); + res.getTagCompound().setInteger("HideFlags", 254); + NBTTagCompound ea = new NBTTagCompound(); + ea.setString("id", internalname); + res.getTagCompound().setTag("ExtraAttributes", ea); + + JsonObject json = manager.getJsonForItem(res); + json.addProperty("internalname", internalname); + + json.addProperty("modver", NotEnoughUpdates.VERSION); + json.addProperty("vanilla", true); + + json.addProperty("clickcommand", ""); + try { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Added: " + internalname)); + manager.writeJsonDefaultDir(json, internalname+".json"); + manager.loadItem(internalname); + } catch(IOException e) {} + } else { + System.out.println("writing with recipe:" + internalname); + for(Map.Entry entry : recipeJsonForDamage.entrySet()) { + ItemStack res = Utils.createItemStack(item, + EnumChatFormatting.WHITE+item.getItemStackDisplayName(new ItemStack(item, 1, entry.getKey())), + EnumChatFormatting.WHITE.toString()+EnumChatFormatting.BOLD+"COMMON"); + res.setItemDamage(entry.getKey()); + res.getTagCompound().setInteger("HideFlags", 254); + NBTTagCompound ea = new NBTTagCompound(); + ea.setString("id", internalname); + res.getTagCompound().setTag("ExtraAttributes", ea); + + JsonObject json = manager.getJsonForItem(res); + + if(entry.getKey() != 0 && entry.getKey() < 32000) { + json.addProperty("internalname", internalname+"-"+entry.getKey()); + json.addProperty("parent", internalname); + } else { + json.addProperty("internalname", internalname); + } + + json.addProperty("modver", NotEnoughUpdates.VERSION); + json.addProperty("vanilla", true); + json.addProperty("clickcommand", "viewrecipe"); + json.add("recipe", entry.getValue()); + try { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Added: " + internalname)); + if(entry.getKey() != 0 && entry.getKey() < 32000) { + manager.writeJsonDefaultDir(json, internalname+"-"+entry.getKey()+".json"); + } else { + manager.writeJsonDefaultDir(json, internalname+".json"); + } + manager.loadItem(internalname); + } catch(IOException e) {} + } + } + } + } + } + + //for(Map.Entry item : manager.getItemInformation().entrySet()) { /*if(!item.getValue().has("infoType") || item.getValue().get("infoType").getAsString().isEmpty()) { if(item.getValue().has("info") && item.getValue().get("info").getAsJsonArray().size()>0) { item.getValue().addProperty("infoType", "WIKI_URL"); @@ -167,7 +1023,7 @@ public class DevInfoPane extends TextInfoPane { } }, 1000L, TimeUnit.MILLISECONDS); }*/ - } + //} /*if(Keyboard.isKeyDown(Keyboard.KEY_J) && !running) { running = true; List add = new ArrayList<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java index 8b35f5cb..00716271 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.infopanes; +import io.github.moulberry.notenoughupdates.BetterContainers; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.util.Utils; @@ -175,6 +176,7 @@ public class SettingsInfoPane extends InfoPane { tf.setCustomBorderColour(-1); option.setValue(tf.getText()); overlay.redrawItems(); + BetterContainers.reset(); } catch(Exception e) { tf.setCustomBorderColour(Color.RED.getRGB()); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java index 06dfd246..da1b9ddc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBAnchorPoint.java @@ -9,9 +9,7 @@ public class MBAnchorPoint implements Serializable { public enum AnchorPoint { TOPLEFT(0, 0), TOPMID(0.5f, 0), TOPRIGHT(1, 0), MIDRIGHT(1, 0.5f), BOTRIGHT(1, 1), BOTMID(0.5f, 1), - BOTLEFT(0, 1), MIDLEFT(0, 0.5f), MIDMID(0.5f, 0.5f), - - INV_BOTMID(0.5f, 1f); + BOTLEFT(0, 1), MIDLEFT(0, 0.5f), MIDMID(0.5f, 0.5f); public final float x; public final float y; @@ -24,27 +22,33 @@ public class MBAnchorPoint implements Serializable { public AnchorPoint anchorPoint; public Vector2f offset; + public boolean inventoryRelative; public MBAnchorPoint(AnchorPoint anchorPoint, Vector2f offset) { + this(anchorPoint, offset, false); + } + + public MBAnchorPoint(AnchorPoint anchorPoint, Vector2f offset, boolean inventoryRelative) { this.anchorPoint = anchorPoint; this.offset = offset; + this.inventoryRelative = inventoryRelative; } public static MBAnchorPoint createFromString(String str) { - if(str == null || str.split(":").length != 3) { + if(str == null || str.split(":").length != 4) { return null; } try { String[] split = str.split(":"); AnchorPoint point = AnchorPoint.valueOf(split[0].toUpperCase()); - Vector2f pos = new Vector2f(Float.valueOf(split[1]), Float.valueOf(split[2])); - return new MBAnchorPoint(point, pos); + Vector2f pos = new Vector2f(Float.parseFloat(split[1]), Float.parseFloat(split[2])); + return new MBAnchorPoint(point, pos, Boolean.parseBoolean(split[3])); } catch(Exception e) { return null; } } @Override public String toString() { - return anchorPoint.toString() + ":" + offset.x + ":" + offset.y; + return anchorPoint.toString() + ":" + offset.x + ":" + offset.y + ":" + inventoryRelative; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBDeserializer.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBDeserializer.java new file mode 100644 index 00000000..8f7d1bc0 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBDeserializer.java @@ -0,0 +1,20 @@ +package io.github.moulberry.notenoughupdates.mbgui; + +import com.google.gson.JsonObject; + +import java.io.IOException; + +public class MBDeserializer { + + public static MBGuiElement deserialize(JsonObject json) { + return null; + } + + public static void serializeAndSave(MBGuiElement element, String filename) throws IOException { + /*JsonObject json = element.serialize(); + + File file = new File(NotEnoughUpdates.INSTANCE.manager.configLocation, filename+".json"); + NotEnoughUpdates.INSTANCE.manager.writeJson(json, file);*/ + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiElement.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiElement.java index 56a3f42c..1ff51238 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiElement.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiElement.java @@ -9,4 +9,6 @@ public abstract class MBGuiElement { public abstract void mouseClickOutside(); public abstract void render(float x, float y); + //public abstract JsonObject serialize(); + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupAligned.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupAligned.java new file mode 100644 index 00000000..77a28fd5 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupAligned.java @@ -0,0 +1,67 @@ +package io.github.moulberry.notenoughupdates.mbgui; + +import org.lwjgl.util.vector.Vector2f; + +import java.util.Collection; +import java.util.List; + +public abstract class MBGuiGroupAligned extends MBGuiGroup { + + //Serialized + private List children; + private boolean vertical; + + public MBGuiGroupAligned(List children, boolean vertical) { + this.children = children; + this.vertical = vertical; + recalculate(); + } + + public abstract int getPadding(); + + public Collection getChildren() { + return children; + } + + public void recalculate() { + for(MBGuiElement child : children) { + child.recalculate(); + } + + if(vertical) { + height = 0; + for(int i=0; i width) { + width = childWidth; + } + } + } else { + width = 0; + for(int i=0; i height) { + height = childHeight; + } + } + } + + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java index 0c44932a..293fc241 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java @@ -2,11 +2,11 @@ package io.github.moulberry.notenoughupdates.mbgui; import io.github.moulberry.notenoughupdates.GuiItemRecipe; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.auction.CustomAH; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; import org.lwjgl.util.vector.Vector2f; @@ -14,10 +14,12 @@ import java.util.*; public class MBGuiGroupFloating extends MBGuiGroup { - private LinkedHashMap children; private GuiScreen lastScreen = null; private HashMap childrenPositionOffset = new HashMap<>(); + //Serialized + private LinkedHashMap children; + public MBGuiGroupFloating(int width, int height, LinkedHashMap children) { this.width = width; this.height = height; @@ -39,6 +41,10 @@ public class MBGuiGroupFloating extends MBGuiGroup { if(lastScreen != currentScreen) { lastScreen = currentScreen; + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int screenWidth = scaledResolution.getScaledWidth(); + int screenHeight = scaledResolution.getScaledHeight(); + int xSize = -1; int ySize = -1; int guiLeft = -1; @@ -83,13 +89,12 @@ public class MBGuiGroupFloating extends MBGuiGroup { childPos = new Vector2f(); } + if(anchorPoint.inventoryRelative) { + int defGuiLeft = (screenWidth - xSize) / 2; + int defGuiTop = (screenHeight - ySize) / 2; - if(anchorPoint.anchorPoint == MBAnchorPoint.AnchorPoint.INV_BOTMID) { - int defGuiLeft = (this.width - xSize) / 2; - int defGuiTop = (this.height - ySize) / 2; - - childPos.x += guiLeft-defGuiLeft + (anchorPoint.anchorPoint.x-0.5f)*xSize; - childPos.y += guiTop-defGuiTop + (anchorPoint.anchorPoint.y-0.5f)*ySize; + childPos.x += guiLeft-defGuiLeft + (0.5f-anchorPoint.anchorPoint.x)*xSize; + childPos.y += guiTop-defGuiTop + (0.5f-anchorPoint.anchorPoint.y)*ySize; } childrenPositionOffset.put(child, childPos); @@ -115,7 +120,7 @@ public class MBGuiGroupFloating extends MBGuiGroup { float x = anchorPoint.anchorPoint.x * width - anchorPoint.anchorPoint.x * child.getWidth() + anchorPoint.offset.x; float y = anchorPoint.anchorPoint.y * height - anchorPoint.anchorPoint.y * child.getHeight() + anchorPoint.offset.y; - if(anchorPoint.anchorPoint == MBAnchorPoint.AnchorPoint.INV_BOTMID) { + if(anchorPoint.inventoryRelative) { x = width*0.5f + anchorPoint.offset.x; y = height*0.5f + anchorPoint.offset.y; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupHorz.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupHorz.java deleted file mode 100644 index cf477eac..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupHorz.java +++ /dev/null @@ -1,47 +0,0 @@ -package io.github.moulberry.notenoughupdates.mbgui; - -import org.lwjgl.util.vector.Vector2f; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -public abstract class MBGuiGroupHorz extends MBGuiGroup { - - private List children; - - public MBGuiGroupHorz(List children) { - this.children = children; - recalculate(); - } - - public abstract int getPadding(); - - public Collection getChildren() { - return children; - } - - public void recalculate() { - for(MBGuiElement child : children) { - child.recalculate(); - } - - width = 0; - for(int i=0; i height) { - height = childHeight; - } - } - } - -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java new file mode 100644 index 00000000..f56093b8 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java @@ -0,0 +1,32 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import io.github.moulberry.notenoughupdates.BetterContainers; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.StreamerMode; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Team; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin({GuiChest.class}) +public class MixinGuiChest { + + private static final String TARGET = "Lnet/minecraft/client/renderer/texture/TextureManager;" + + "bindTexture(Lnet/minecraft/util/ResourceLocation;)V"; + @Redirect(method="drawGuiContainerBackgroundLayer", at=@At(value="INVOKE", target=TARGET)) + public void drawGuiContainerBackgroundLayer_bindTexture(TextureManager textureManager, ResourceLocation location) { + BetterContainers.bindHook(textureManager, location); + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java new file mode 100644 index 00000000..879d348b --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -0,0 +1,52 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import io.github.moulberry.notenoughupdates.BetterContainers; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(GuiContainer.class) +public abstract class MixinGuiContainer { + + @Inject(method="drawSlot", at=@At("HEAD"), cancellable = true) + public void drawSlot(Slot slot, CallbackInfo ci) { + if(slot != null && BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.getStack())) { + ci.cancel(); + } + } + + private static final String TARGET_CANBEHOVERED = "Lnet/minecraft/inventory/Slot;canBeHovered()Z"; + @Redirect(method="drawScreen", at=@At(value="INVOKE", target=TARGET_CANBEHOVERED)) + public boolean drawScreen_canBeHovered(Slot slot) { + if(BetterContainers.isBlankStack(slot.getStack())) { + return false; + } + return slot.canBeHovered(); + } + + @Inject(method="handleMouseClick", at=@At(value="HEAD"), cancellable = true) + public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { + if(slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(slotIn.getStack()) || + BetterContainers.isButtonStack(slotIn.getStack()))) { + BetterContainers.clickSlot(slotIn.getSlotIndex()); + Utils.playPressSound(); + + GuiContainer $this = (GuiContainer)(Object)this; + $this.mc.playerController.windowClick($this.inventorySlots.windowId, slotId, 2, clickType, $this.mc.thePlayer); + ci.cancel(); + } + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java index 9dc0e714..294a8873 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java @@ -183,6 +183,16 @@ public class Options { "Coloured Tooltip Border Opacity", false, "Coloured tooltips only apply to tooltips in my GUIs. Value between 0-255.", 0, 255); + public Option dynamicMenuBackgroundStyle = new Option( + 1.0, + "SBMenu Background Style", + false, + "Style of the background used for the skyblock menu.", 0, 10); + public Option dynamicMenuButtonStyle = new Option( + 1.0, + "SBMenu Button Style", + false, + "Style of the buttons used for the skyblock menu.", 0, 10); /** * OPTIONS THAT DON'T SHOW IN GUI @@ -355,6 +365,8 @@ public class Options { tryAddOption(itemHighlightOpacity, options); tryAddOption(panePadding, options); tryAddOption(tooltipBorderOpacity, options); + tryAddOption(dynamicMenuBackgroundStyle, options); + tryAddOption(dynamicMenuButtonStyle, options); //Text tryAddOption(apiKey, options); 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 ae64c548..837addf3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -7,35 +7,24 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.properties.Property; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.SBAIntegration; import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; import io.github.moulberry.notenoughupdates.questing.SBScoreboardData; -import io.github.moulberry.notenoughupdates.util.TexLoc; import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.SkinManager; import net.minecraft.client.shader.Framebuffer; import net.minecraft.client.shader.Shader; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -43,14 +32,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.Charsets; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; -import org.luaj.vm2.ast.Str; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -58,9 +40,7 @@ import org.lwjgl.opengl.GL14; import org.lwjgl.opengl.GL20; import java.awt.*; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.nio.charset.Charset; import java.text.NumberFormat; import java.util.*; import java.util.List; @@ -174,7 +154,7 @@ public class GuiProfileViewer extends GuiScreen { Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bg); Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); - if(!(currentPage == ProfileViewerPage.LOADING)) { + if(!(currentPage == ProfileViewerPage.LOADING) && profileId != null) { playerNameTextField.render(guiLeft+sizeX-100, guiTop+sizeY+5); ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -200,7 +180,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23, 100, sizeYDropdown-4, 100/200f, 1, (181-sizeYDropdown)/185f, 181/185f, GL11.GL_NEAREST); - for(int yIndex=0; yIndex 0) { - int yPosition = 3; - int xPosition = 1; - - int x = guiLeft+237+86*xPosition; - int y = guiTop+31+21*yPosition; - - renderAlignedString(EnumChatFormatting.GRAY+"Catacombs", EnumChatFormatting.WHITE.toString()+cata, x+14, y-4, 60); - - renderBar(x, y+6, 80, cata/50f); - - if(mouseX > x && mouseX < x+80) { - if(mouseY > y-4 && mouseY < y+13) { - String levelStr; - if(cata == 50) { - levelStr = EnumChatFormatting.GOLD+"MAXED!"; - } else { - levelStr = EnumChatFormatting.DARK_PURPLE.toString() + cata + "/50"; - } - - tooltipToDisplay = Utils.createList(levelStr); - } - } - - GL11.glTranslatef((x), (y-6f), 0); - GL11.glScalef(0.7f, 0.7f, 1); - Utils.drawItemStackLinear(new ItemStack(Item.getItemFromBlock(Blocks.deadbush)), 0, 0); - GL11.glScalef(1/0.7f, 1/0.7f, 1); - GL11.glTranslatef(-(x), -(y-6f), 0); - } - if(skillInfo != null) { int position = 0; for(Map.Entry entry : ProfileViewer.getSkillToSkillDisplayMap().entrySet()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index dac93e6f..36a616bb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -137,17 +137,20 @@ public class PlayerStats { for(Map.Entry entry : skillInfo.entrySet()) { if(entry.getKey().startsWith("level_")) { String skill = entry.getKey().substring("level_".length()); - JsonObject skillStatMap = Utils.getElement(bonuses, "bonus_stats."+skill).getAsJsonObject(); - - Stats currentBonus = new Stats(); - for(int i=1; i<=entry.getValue().getAsFloat(); i++) { - if(skillStatMap.has(""+i)) { - currentBonus = new Stats(); - for(Map.Entry entry2 : skillStatMap.get(""+i).getAsJsonObject().entrySet()) { - currentBonus.addStat(entry2.getKey(), entry2.getValue().getAsFloat()); + JsonElement element = Utils.getElement(bonuses, "bonus_stats."+skill); + if(element != null && element.isJsonObject()) { + JsonObject skillStatMap = element.getAsJsonObject(); + + Stats currentBonus = new Stats(); + for(int i=1; i<=entry.getValue().getAsFloat(); i++) { + if(skillStatMap.has(""+i)) { + currentBonus = new Stats(); + for(Map.Entry entry2 : skillStatMap.get(""+i).getAsJsonObject().entrySet()) { + currentBonus.addStat(entry2.getKey(), entry2.getValue().getAsFloat()); + } } + skillBonus.add(currentBonus); } - skillBonus.add(currentBonus); } } } 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 b6a0ce06..9c1de286 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -58,7 +58,7 @@ public class ProfileViewer { skillToSkillDisplayMap.put("skill_fishing", Utils.createItemStack(Items.fishing_rod, EnumChatFormatting.AQUA+"Fishing")); skillToSkillDisplayMap.put("skill_alchemy", Utils.createItemStack(Items.brewing_stand, EnumChatFormatting.BLUE+"Alchemy")); skillToSkillDisplayMap.put("skill_runecrafting", Utils.createItemStack(Items.magma_cream, EnumChatFormatting.DARK_PURPLE+"Runecrafting")); - skillToSkillDisplayMap.put(null, null); + skillToSkillDisplayMap.put("skill_catacombs", Utils.createItemStack(Item.getItemFromBlock(Blocks.deadbush), EnumChatFormatting.GOLD+"Catacombs")); skillToSkillDisplayMap.put("slayer_zombie", Utils.createItemStack(Items.rotten_flesh, EnumChatFormatting.GOLD+"Rev Slayer")); skillToSkillDisplayMap.put("slayer_spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD+"Tara Slayer")); skillToSkillDisplayMap.put("slayer_wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD+"Sven Slayer")); @@ -127,7 +127,7 @@ public class ProfileViewer { EnumChatFormatting.YELLOW+"Seeds")); collectionToCollectionDisplayMap.put("MUSHROOM_COLLECTION", Utils.createItemStack(Item.getItemFromBlock(Blocks.red_mushroom) - , EnumChatFormatting.YELLOW+"Mushroom")); + , EnumChatFormatting.YELLOW+"Mushroom")); collectionToCollectionDisplayMap.put("INK_SACK:3", Utils.createItemStack(Items.dye, EnumChatFormatting.YELLOW+"Cocoa Beans", 3)); collectionToCollectionDisplayMap.put("CACTUS", Utils.createItemStack(Item.getItemFromBlock(Blocks.cactus), @@ -163,7 +163,7 @@ public class ProfileViewer { collectionToCollectionDisplayMap.put("INK_SACK:4", Utils.createItemStack(Items.dye, EnumChatFormatting.GRAY+"Lapis Lazuli", 4)); collectionToCollectionDisplayMap.put("EMERALD", Utils.createItemStack(Items.emerald, - EnumChatFormatting.GRAY+"Emerald")); + EnumChatFormatting.GRAY+"Emerald")); collectionToCollectionDisplayMap.put("REDSTONE", Utils.createItemStack(Items.redstone, EnumChatFormatting.GRAY+"Redstone")); collectionToCollectionDisplayMap.put("QUARTZ", Utils.createItemStack(Items.quartz, @@ -276,7 +276,6 @@ public class ProfileViewer { private HashMap stats = new HashMap<>(); private HashMap passiveStats = new HashMap<>(); private long networth = -1; - private int dungeonCatacombsLevel = -1; public Profile(String uuid) { this.uuid = uuid; @@ -294,123 +293,19 @@ public class ProfileViewer { HashMap args = new HashMap<>(); args.put("uuid", ""+uuid); manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "status", - args, jsonObject -> { - if(jsonObject == null) return; + args, jsonObject -> { + if(jsonObject == null) return; - updatingPlayerStatusState.set(false); - if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { - playerStatus = jsonObject.get("session").getAsJsonObject(); - } - }, () -> updatingPlayerStatusState.set(false) + updatingPlayerStatusState.set(false); + if(jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { + playerStatus = jsonObject.get("session").getAsJsonObject(); + } + }, () -> updatingPlayerStatusState.set(false) ); return null; } - public int getDungeonCatacombsLevel(String profileId) { - if (dungeonCatacombsLevel != -1) return dungeonCatacombsLevel; - if (getInventoryInfo(profileId) == null) return -1; - - JsonObject inventoryInfo = getInventoryInfo(profileId); - - Pattern pattern = Pattern.compile("\\u00A77[A-Za-z ]+: \\u00A7[a-f0-9]\\+(\\d+).+\\u00A78\\(\\+?([0-9\\.]+)(%| HP)?\\)"); - - List nums = new ArrayList<>(); - - try { - for(Map.Entry entry : inventoryInfo.entrySet()) { - if(entry.getValue().isJsonArray()) { - for(JsonElement element : entry.getValue().getAsJsonArray()) { - if(element != null && element.isJsonObject()) { - JsonObject item = element.getAsJsonObject(); - String internalname = item.get("internalname").getAsString(); - - //TODO: Make sure item is a catacombs level (using internalname) - - int dungeon_item_level = 0; - if(item.has("dungeon_item_level")) { - dungeon_item_level = item.get("dungeon_item_level").getAsInt(); - } - - if(item.has("lore") && item.get("lore").isJsonArray()) { - for(JsonElement lineElement : item.get("lore").getAsJsonArray()) { - if(lineElement.isJsonPrimitive()) { - String line = lineElement.getAsString(); - Matcher matcher = pattern.matcher(line); - if(matcher.matches()) { - String num1S = matcher.group(1); - String num2S = matcher.group(2); - - int num1 = Integer.parseInt(num1S); - float num2 = Float.parseFloat(num2S); - - float bonus = num2/num1 - dungeon_item_level*0.1f; - - if(bonus > 1) nums.add(bonus); - } - } - } - } - - try { - if(item.has("item_contents")) { - JsonArray bytesArr = item.get("item_contents").getAsJsonArray(); - byte[] bytes = new byte[bytesArr.size()]; - for (int bytesArrI = 0; bytesArrI < bytesArr.size(); bytesArrI++) { - bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte(); - } - NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes)); - NBTTagList items = contents_nbt.getTagList("i", 10); - for(int j=0; j 0) { - JsonObject item2 = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j)); - - int dungeon_item_level2 = 0; - if(item2.has("dungeon_item_level")) { - dungeon_item_level2 = item2.get("dungeon_item_level").getAsInt(); - } - - if(item2.has("lore") && item2.get("lore").isJsonArray()) { - for(JsonElement lineElement : item2.get("lore").getAsJsonArray()) { - if(lineElement.isJsonPrimitive()) { - String line = lineElement.getAsString(); - Matcher matcher = pattern.matcher(line); - if(matcher.matches()) { - String num1S = matcher.group(1); - String num2S = matcher.group(2); - - int num1 = Integer.parseInt(num1S); - float num2 = Float.parseFloat(num2S); - - float bonus = num2/num1 - dungeon_item_level2*0.1f; - - if(bonus > 1) nums.add(bonus); - } - } - } - } - } - } - } - } catch(IOException ignored) {} - } - } - } - } - } catch(Exception ignored) {} - - if(nums.size() > 0) { - nums.sort(Comparator.naturalOrder()); - int bonus = -100+Math.round(100*nums.get(nums.size()/2)); - dungeonCatacombsLevel = 0; - while(bonus > 0) { - dungeonCatacombsLevel++; - bonus -= 3+Math.ceil(dungeonCatacombsLevel/5f); - } - } - return dungeonCatacombsLevel; - } - public long getNetWorth(String profileId) { if(networth != -1) return networth; if(getProfileInformation(profileId) == null) return -1; @@ -448,6 +343,8 @@ public class ProfileViewer { NBTTagCompound nbt = items.getCompoundTagAt(j).getCompoundTag("tag"); String internalname2 = manager.getInternalnameFromNBT(nbt); if(internalname2 != null) { + if(manager.auctionManager.isVanillaItem(internalname2)) continue; + JsonObject info2 = manager.auctionManager.getItemAuctionInfo(internalname2); if(info2 == null || !info2.has("price") || !info2.has("count")) continue; int auctionPrice2 = (int)(info2.get("price").getAsFloat() / info2.get("count").getAsFloat()); @@ -647,7 +544,6 @@ public class ProfileViewer { inventoryInfoMap.clear(); collectionInfoMap.clear(); networth = -1; - dungeonCatacombsLevel = -1; } private class Level { @@ -699,6 +595,9 @@ public class ProfileViewer { float experience_skill_alchemy = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_alchemy"), 0); float experience_skill_runecrafting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_runecrafting"), 0); + float experience_skill_catacombs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.experience"), 0); + if(uuid.equals("d14403fd77664905929ee1a6e365e623")) experience_skill_catacombs = 569809640; //lvl 50 + float experience_slayer_zombie = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.xp"), 0); float experience_slayer_spider = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.xp"), 0); float experience_slayer_wolf = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.xp"), 0); @@ -706,6 +605,7 @@ public class ProfileViewer { float totalSkillXP = experience_skill_taming + experience_skill_mining + experience_skill_foraging + experience_skill_enchanting + experience_skill_carpentry + experience_skill_farming + experience_skill_combat + experience_skill_fishing + experience_skill_alchemy + + experience_skill_catacombs + experience_skill_runecrafting; if(totalSkillXP <= 0) { @@ -725,6 +625,8 @@ public class ProfileViewer { skillInfo.addProperty("experience_skill_alchemy", experience_skill_alchemy); skillInfo.addProperty("experience_skill_runecrafting", experience_skill_runecrafting); + skillInfo.addProperty("experience_skill_catacombs", experience_skill_catacombs); + skillInfo.addProperty("experience_slayer_zombie", experience_slayer_zombie); skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider); skillInfo.addProperty("experience_slayer_wolf", experience_slayer_wolf); @@ -740,6 +642,8 @@ public class ProfileViewer { Level level_skill_alchemy = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_alchemy, false); Level level_skill_runecrafting = getLevel(Utils.getElement(leveling, "runecrafting_xp").getAsJsonArray(), experience_skill_runecrafting, false); + Level level_skill_catacombs = getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(), experience_skill_catacombs, false); + Level level_slayer_zombie = getLevel(Utils.getElement(leveling, "slayer_xp.zombie").getAsJsonArray(), experience_slayer_zombie, true); Level level_slayer_spider = getLevel(Utils.getElement(leveling, "slayer_xp.spider").getAsJsonArray(), experience_slayer_spider, true); Level level_slayer_wolf = getLevel(Utils.getElement(leveling, "slayer_xp.wolf").getAsJsonArray(), experience_slayer_wolf, true); @@ -755,6 +659,8 @@ public class ProfileViewer { skillInfo.addProperty("level_skill_alchemy", level_skill_alchemy.level); skillInfo.addProperty("level_skill_runecrafting", level_skill_runecrafting.level); + skillInfo.addProperty("level_skill_catacombs", level_skill_catacombs.level); + skillInfo.addProperty("level_slayer_zombie", level_slayer_zombie.level); skillInfo.addProperty("level_slayer_spider", level_slayer_spider.level); skillInfo.addProperty("level_slayer_wolf", level_slayer_wolf.level); @@ -770,6 +676,8 @@ public class ProfileViewer { skillInfo.addProperty("maxed_skill_alchemy", level_skill_alchemy.maxed); skillInfo.addProperty("maxed_skill_runecrafting", level_skill_runecrafting.maxed); + skillInfo.addProperty("maxed_skill_catacombs", level_skill_catacombs.maxed); + skillInfo.addProperty("maxed_slayer_zombie", level_slayer_zombie.maxed); skillInfo.addProperty("maxed_slayer_spider", level_slayer_spider.maxed); skillInfo.addProperty("maxed_slayer_wolf", level_slayer_wolf.maxed); @@ -785,6 +693,8 @@ public class ProfileViewer { skillInfo.addProperty("maxxp_skill_alchemy", level_skill_alchemy.maxXpForLevel); skillInfo.addProperty("maxxp_skill_runecrafting", level_skill_runecrafting.maxXpForLevel); + skillInfo.addProperty("maxxp_skill_catacombs", level_skill_catacombs.maxXpForLevel); + skillInfo.addProperty("maxxp_slayer_zombie", level_slayer_zombie.maxXpForLevel); skillInfo.addProperty("maxxp_slayer_spider", level_slayer_spider.maxXpForLevel); skillInfo.addProperty("maxxp_slayer_wolf", level_slayer_wolf.maxXpForLevel); @@ -1030,17 +940,17 @@ public class ProfileViewer { HashMap args = new HashMap<>(); args.put("name", ""+name); manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "player", - args, jsonObject -> { - if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean() - && jsonObject.get("player").isJsonObject()) { - nameToHypixelProfile.put(name, jsonObject.get("player").getAsJsonObject()); - uuidToHypixelProfile.put(jsonObject.get("player").getAsJsonObject().get("uuid").getAsString(), jsonObject.get("player").getAsJsonObject()); - if(callback != null) callback.accept(jsonObject); - } else { - if(callback != null) callback.accept(null); - return; + args, jsonObject -> { + if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean() + && jsonObject.get("player").isJsonObject()) { + nameToHypixelProfile.put(name, jsonObject.get("player").getAsJsonObject()); + uuidToHypixelProfile.put(jsonObject.get("player").getAsJsonObject().get("uuid").getAsString(), jsonObject.get("player").getAsJsonObject()); + if(callback != null) callback.accept(jsonObject); + } else { + if(callback != null) callback.accept(null); + return; + } } - } ); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java index 5ea6c023..d6f89409 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java @@ -84,6 +84,7 @@ public class HypixelApi { URL url = new URL(urlS); URLConnection connection = url.openConnection(); connection.setConnectTimeout(3000); + connection.setReadTimeout(10000); String response = IOUtils.toString(connection.getInputStream(), StandardCharsets.UTF_8); @@ -95,6 +96,7 @@ public class HypixelApi { URL url = new URL(urlS); URLConnection connection = url.openConnection(); connection.setConnectTimeout(3000); + connection.setReadTimeout(10000); String response = IOUtils.toString(new GZIPInputStream(connection.getInputStream()), StandardCharsets.UTF_8); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/TexLoc.java b/src/main/java/io/github/moulberry/notenoughupdates/util/TexLoc.java index 48eea22d..5e792cf5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/TexLoc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/TexLoc.java @@ -20,7 +20,7 @@ public class TexLoc { this.toggleKey = toggleKey; } - public void handleKeyboardInput() { + public boolean handleKeyboardInput() { int mult=1; if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) mult=10; if(Keyboard.isKeyDown(toggleKey)) { @@ -31,7 +31,7 @@ public class TexLoc { } else { pressedLastTick = false; } - if(toggled) { + if(toggled || toggleKey == 0) { if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { if(!dirPressed) x-=mult; dirPressed = true; @@ -46,10 +46,12 @@ public class TexLoc { dirPressed = true; } else { dirPressed = false; - return; + return false; } System.out.println("X: " + x + " ; Y: " + y); + return true; } + return false; } } diff --git a/src/main/resources/assets/notenoughupdates/accessory_bag_overlay.png b/src/main/resources/assets/notenoughupdates/accessory_bag_overlay.png new file mode 100644 index 00000000..6fcac4d1 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/accessory_bag_overlay.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/dynamic_54_button_ctm.png b/src/main/resources/assets/notenoughupdates/dynamic_54/dynamic_54_button_ctm.png new file mode 100644 index 00000000..bab0eab7 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/dynamic_54_button_ctm.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54.png new file mode 100644 index 00000000..934f6b4a Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_button_ctm.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_button_ctm.png new file mode 100644 index 00000000..956d085a Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_button_ctm.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_slot_ctm.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_slot_ctm.png new file mode 100644 index 00000000..fa43a0ed Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style1/dynamic_54_slot_ctm.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style2/dynamic_54.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style2/dynamic_54.png new file mode 100644 index 00000000..73711ee8 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style2/dynamic_54.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54.png new file mode 100644 index 00000000..3a24654d Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54_button_ctm.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54_button_ctm.png new file mode 100644 index 00000000..fa43a0ed Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style3/dynamic_54_button_ctm.png differ diff --git a/src/main/resources/assets/notenoughupdates/dynamic_54/style4/dynamic_54_button_ctm.png b/src/main/resources/assets/notenoughupdates/dynamic_54/style4/dynamic_54_button_ctm.png new file mode 100644 index 00000000..ea57f0d0 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/dynamic_54/style4/dynamic_54_button_ctm.png differ diff --git a/src/main/resources/assets/notenoughupdates/item_haschild.png b/src/main/resources/assets/notenoughupdates/item_haschild.png new file mode 100644 index 00000000..c3f3369a Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/item_haschild.png differ diff --git a/src/main/resources/assets/notenoughupdates/quickcommand_background.png b/src/main/resources/assets/notenoughupdates/quickcommand_background.png new file mode 100644 index 00000000..d3c2a3ad Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/quickcommand_background.png differ diff --git a/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag index b3cb8a1d..e3e5d56e 100644 --- a/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag +++ b/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag @@ -23,7 +23,7 @@ void main() { } } } else if(eventRand < 0.45f) { - vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.4f)/0.05f*300.0f)/1024.0f; + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.4f)/0.05f*300.0f)/1024.0f; vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+248.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); if(extraTexCoord.x > 200.0f/1024.0f && extraTexCoord.x < 300.0f/1024.0f) { if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { @@ -31,7 +31,7 @@ void main() { } } } else if(eventRand < 0.47f) { - vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.45f)/0.02f*300.0f)/1024.0f; + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.45f)/0.02f*300.0f)/1024.0f; vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+348.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); if(extraTexCoord.x > 300.0f/1024.0f && extraTexCoord.x < 400.0f/1024.0f) { if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { @@ -39,7 +39,7 @@ void main() { } } } else if(eventRand < 0.48f) { - vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.47f)/0.01f*300.0f)/1024.0f; + vec2 extraPos = vec2(-30.0f+eventMillis/2000.0f*370.0f, 50.0f+(eventRand-0.47f)/0.01f*300.0f)/1024.0f; vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+448.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f); if(extraTexCoord.x > 400.0f/1024.0f && extraTexCoord.x < 500.0f/1024.0f) { if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) { diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index f797c921..1ef9ee69 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -9,6 +9,8 @@ "MixinRenderItem", "MixinEntityRenderer", "MixinRenderGlobal", - "MixinNetHandlerPlayClient" + "MixinNetHandlerPlayClient", + "MixinGuiChest", + "MixinGuiContainer" ] } \ No newline at end of file -- cgit