diff options
author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-01 04:28:36 +1100 |
---|---|---|
committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-01 04:28:36 +1100 |
commit | 36af336e49662390c0f553da6f7f5ec424e5d37b (patch) | |
tree | aeab2d8fcb87fd50b4995bfd10cc6da75bd5d3a8 /src/main/java/io | |
parent | 431d4a5eca207aa6f86a90e3c4e1912885f115eb (diff) | |
download | NotEnoughUpdates-36af336e49662390c0f553da6f7f5ec424e5d37b.tar.gz NotEnoughUpdates-36af336e49662390c0f553da6f7f5ec424e5d37b.tar.bz2 NotEnoughUpdates-36af336e49662390c0f553da6f7f5ec424e5d37b.zip |
Diffstat (limited to 'src/main/java/io')
15 files changed, 505 insertions, 320 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java index d8d84144..5ca25082 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java @@ -64,6 +64,17 @@ public class AccessoryBagOverlay { private static int currentTab = TAB_BASIC; public static boolean mouseClick() { + 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")) { + return false; + } + } else { + return false; + } + if(!Mouse.getEventButtonState()) return false; try { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java b/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java deleted file mode 100644 index 07205519..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.github.moulberry.notenoughupdates; - -import java.util.Arrays; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.ModMetadata; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class DumymMod { - - @SubscribeEvent - public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { - int width = event.gui.width / 2; - int height = event.gui.height / 2 - 106; - - if (event.gui instanceof GuiChest) - { - event.buttonList.add(new GuiButtonItem(1001, width + 88, height + 47, new ItemStack(Blocks.crafting_table))); - event.buttonList.add(new GuiButtonItem(1000, width + 88, height + 66, new ItemStack(Blocks.ender_chest))); - } - } - - private long lastButtonClick = -1; - - @SubscribeEvent - public void onPostActionPerformedGui(GuiScreenEvent.ActionPerformedEvent.Post event) { - long now = System.currentTimeMillis(); - - if (event.gui instanceof GuiChest) - { - if (now - this.lastButtonClick > 100L) - { - if (event.button.id == 1000) - { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/enderchest"); - } - else if (event.button.id == 1001) - { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/craft"); - } - this.lastButtonClick = now; - } - } - } -}
\ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java index cdf7b59b..f0b92c6a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java @@ -39,7 +39,7 @@ public class DungeonBlocks implements IResourceManagerReloadListener { } public static boolean isInDungeons() { - return false && !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value && + return !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value && (NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value || (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon"))); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java index daff1a24..79b9e106 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java @@ -53,6 +53,7 @@ public class DungeonMap { private static final ResourceLocation GREEN_CHECK = new ResourceLocation("notenoughupdates:dungeon_map/green_check.png"); private static final ResourceLocation WHITE_CHECK = new ResourceLocation("notenoughupdates:dungeon_map/white_check.png"); private static final ResourceLocation QUESTION = new ResourceLocation("notenoughupdates:dungeon_map/question.png"); + private static final ResourceLocation CROSS = new ResourceLocation("notenoughupdates:dungeon_map/cross.png"); private static final ResourceLocation ROOM_RED = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/red_room.png"); private static final ResourceLocation ROOM_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/brown_room.png"); @@ -187,6 +188,8 @@ public class DungeonMap { indicatorTex = GREEN_CHECK; } else if(tick.getRed() == 13 && tick.getGreen() == 13 && tick.getBlue() == 13) { indicatorTex = QUESTION; + } else if(tick.getRed() == 255 && tick.getGreen() == 0 && tick.getBlue() == 0) { + indicatorTex = CROSS; } if(indicatorTex != null) { Minecraft.getMinecraft().getTextureManager().bindTexture(indicatorTex); @@ -353,12 +356,14 @@ public class DungeonMap { public int getRenderRoomSize() { int roomSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value.intValue(); - return roomSizeOption == 0 ? 12 : roomSizeOption == 2 ? 20 : 16; + if(roomSizeOption <= 0) return 12; + return 12 + roomSizeOption*4; } public int getRenderConnSize() { int roomSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value.intValue(); - return roomSizeOption == 0 ? 3 : roomSizeOption == 2 ? 5 : 4; + if(roomSizeOption <= 0) return 3; + return 3 + roomSizeOption; } private HashMap<Integer, Float> borderRadiusCache = new HashMap<>(); @@ -429,8 +434,8 @@ public class DungeonMap { rotation = (int)playerPos.rotation; } - int mapSizeX = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : 120; - int mapSizeY = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : 120; + int mapSizeX = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : borderSizeOption == 3 ? 240 : 120; + int mapSizeY = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : borderSizeOption == 3 ? 240 : 120; int roomsSizeX = (maxRoomX-minRoomX)*(renderRoomSize+renderConnSize)+renderRoomSize; int roomsSizeY = (maxRoomY-minRoomY)*(renderRoomSize+renderConnSize)+renderRoomSize; int mapCenterX = mapSizeX/2; @@ -588,7 +593,7 @@ public class DungeonMap { float deltaX = entityPos.getRenderX() - pos.getRenderX(); float deltaY = entityPos.getRenderY() - pos.getRenderY(); - /*if(deltaX > (renderRoomSize + renderConnSize)/2) { + if(deltaX > (renderRoomSize + renderConnSize)/2) { deltaX -= (renderRoomSize + renderConnSize); } else if(deltaX < -(renderRoomSize + renderConnSize)/2) { deltaX += (renderRoomSize + renderConnSize); @@ -597,7 +602,7 @@ public class DungeonMap { deltaY -= (renderRoomSize + renderConnSize); } else if(deltaY < -(renderRoomSize + renderConnSize)/2) { deltaY += (renderRoomSize + renderConnSize); - }*/ + } x += deltaX; y += deltaY; @@ -636,13 +641,18 @@ public class DungeonMap { } } + boolean headLayer = false; int pixelWidth = 8; int pixelHeight = 8; + if(renderRoomSize >= 24) { + pixelWidth = pixelHeight = 12; + } GlStateManager.color(1, 1, 1, 1); if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 1 && playerSkinMap.containsKey(entry.getKey())) { Minecraft.getMinecraft().getTextureManager().bindTexture(playerSkinMap.get(entry.getKey())); + headLayer = true; if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 3) { minU = 9/64f; minV = 9/64f; @@ -656,8 +666,8 @@ public class DungeonMap { } if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 2) { - pixelWidth = 6; - pixelHeight = 6; + pixelWidth = pixelWidth*6/8; + pixelHeight = pixelHeight*6/8; } } else { Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); @@ -682,6 +692,14 @@ public class DungeonMap { worldrenderer.pos(-pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, maxV).endVertex(); tessellator.draw(); + if(headLayer) { + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(minU+0.5f, minV).endVertex(); + worldrenderer.pos(pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(maxU+0.5f, minV).endVertex(); + worldrenderer.pos(pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(maxU+0.5f, maxV).endVertex(); + worldrenderer.pos(-pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)+0.001f).tex(minU+0.5f, maxV).endVertex(); + tessellator.draw(); + } GlStateManager.popMatrix(); k--; } @@ -775,7 +793,7 @@ public class DungeonMap { Minecraft.getMinecraft().getTextureManager().bindTexture(rl); GlStateManager.color(1, 1, 1, 1); - int size = borderSizeOption == 0 ? 165 : borderSizeOption == 2 ? 300 : 220; + int size = borderSizeOption == 0 ? 165 : borderSizeOption == 2 ? 300 : borderSizeOption == 3 ? 440 : 220; Utils.drawTexturedRect(-size/2, -size/2, size, size, GL11.GL_NEAREST); } @@ -1308,6 +1326,12 @@ public class DungeonMap { if(SBInfo.getInstance().getLocation() == null || !SBInfo.getInstance().getLocation().equals("dungeon")) { return; } + if(Minecraft.getMinecraft().gameSettings.showDebugInfo || + (Minecraft.getMinecraft().gameSettings.keyBindPlayerList.isKeyDown() && + (!Minecraft.getMinecraft().isIntegratedServerRunning() || + Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap().size() > 1))) { + return; + } ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.mainInventory[8]; boolean holdingBow = stack != null && stack.getItem() == Items.arrow; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java deleted file mode 100644 index a08b27bc..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java +++ /dev/null @@ -1,93 +0,0 @@ -package io.github.moulberry.notenoughupdates; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; - -public class GuiButtonItem extends GuiButton -{ - private static final ResourceLocation TEXTURE = new ResourceLocation("dummy:textures/gui/blank.png"); - private ItemStack itemStack; - private String customName; - - public GuiButtonItem(int buttonID, int xPos, int yPos, ItemStack itemStack) - { - this(buttonID, xPos, yPos, xPos, itemStack, itemStack.getDisplayName()); - } - - public GuiButtonItem(int buttonID, int xPos, int yPos, int potionX, ItemStack itemStack) - { - this(buttonID, xPos, yPos, potionX, itemStack, itemStack.getDisplayName()); - } - - public GuiButtonItem(int buttonID, int xPos, int yPos, ItemStack itemStack, String customName) - { - this(buttonID, xPos, yPos, xPos, itemStack, customName); - } - - public GuiButtonItem(int buttonID, int xPos, int yPos, int potionX, ItemStack itemStack, String customName) - { - super(buttonID, xPos, yPos, 18, 18, ""); - this.itemStack = itemStack; - this.customName = customName; - } - - @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - - if (this.visible) - { - if (this.itemStack.getItem() == Items.nether_star) - { - ItemStack skyBlockMenu = this.itemStack.copy(); - NBTTagList list = new NBTTagList(); - skyBlockMenu.setStackDisplayName("SkyBlock Menu"); - list.appendTag(new NBTTagString(EnumChatFormatting.GRAY + "View all of your SkyBlock")); - skyBlockMenu.getTagCompound().getCompoundTag("display").setTag("Lore", list); - this.itemStack = skyBlockMenu; - } - - mc.getTextureManager().bindTexture(TEXTURE); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Gui.drawModalRectWithCustomSizedTexture(this.xPosition, this.yPosition, flag ? 18 : 0, 0, this.width, this.height, 36, 18); - - GlStateManager.enableDepth(); - GlStateManager.enableRescaleNormal(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - RenderHelper.enableGUIStandardItemLighting(); - GlStateManager.enableLighting(); - mc.getRenderItem().renderItemAndEffectIntoGUI(this.itemStack, this.xPosition + 1, this.yPosition + 1); - } - } - - public String getName() - { - return this.customName; - } - - public ItemStack getItemStack() - { - return this.itemStack; - } - - public void setName(String name) - { - this.customName = name; - } - - public void setItemStack(ItemStack itemStack) - { - this.itemStack = itemStack; - } -}
\ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java index 5bc4b6ee..6058dc51 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java @@ -78,12 +78,31 @@ public class GuiDungeonMapEditor extends GuiScreen { private int y; private String text; private Color colour = new Color(-1, true); + private Options.Option<?> option; public Button(int id, int x, int y, String text) { + this(id, x, y, text, null); + } + + public Button(int id, int x, int y, String text, Options.Option<?> option) { this.id = id; this.x = x; this.y = y; this.text = text; + this.option = option; + } + + public List<String> getTooltip() { + if(option == null) { + return null; + } + + List<String> tooltip = new ArrayList<>(); + tooltip.add(EnumChatFormatting.YELLOW+option.displayName); + for(String line : option.desc.split("\n")) { + tooltip.add(EnumChatFormatting.AQUA+line); + } + return tooltip; } public void render() { @@ -107,54 +126,58 @@ public class GuiDungeonMapEditor extends GuiScreen { } public GuiDungeonMapEditor() { + Options options = NotEnoughUpdates.INSTANCE.manager.config; //Map Border Size - buttons.add(new Button(0, 6, 37, "Small")); - buttons.add(new Button(1, 52, 37, "Medium")); - buttons.add(new Button(2, 98, 37, "Large")); + buttons.add(new Button(0, 6, 37, "Small", options.dmBorderSize)); + buttons.add(new Button(1, 52, 37, "Medium", options.dmBorderSize)); + buttons.add(new Button(2, 98, 37, "Large", options.dmBorderSize)); //Map Rooms Size - buttons.add(new Button(3, 6, 67, "Small")); - buttons.add(new Button(4, 52, 67, "Medium")); - buttons.add(new Button(5, 98, 67, "Large")); + buttons.add(new Button(3, 6, 67+19, "Small", options.dmRoomSize)); + buttons.add(new Button(4, 52, 67+19, "Medium", options.dmRoomSize)); + buttons.add(new Button(5, 98, 67+19, "Large", options.dmRoomSize)); //Map Border Styles - buttons.add(new Button(6, 6, 97, "Default")); - buttons.add(new Button(7, 52, 97, "Custom")); - buttons.add(new Button(8, 98, 97, "Stone")); - buttons.add(new Button(9, 6, 116, "Wood")); - buttons.add(new Button(10, 52, 116, "Rustic(S)")); - buttons.add(new Button(11, 98, 116, "Rustic(C)")); - buttons.add(new Button(12, 6, 135, "Fade")); - buttons.add(new Button(13, 52, 135, "Ribbons")); - buttons.add(new Button(14, 98, 135, "Paper")); - buttons.add(new Button(15, 6, 154, "Crimson")); - buttons.add(new Button(16, 52, 154, "Ornate")); - buttons.add(new Button(17, 98, 154, "Dragon")); + buttons.add(new Button(6, 6, 97+38, "None")); + buttons.add(new Button(7, 52, 97+38, "Custom")); + buttons.add(new Button(8, 98, 97+38, "Stone")); + buttons.add(new Button(9, 6, 116+38, "Wood")); + buttons.add(new Button(10, 52, 116+38, "Rustic(S)")); + buttons.add(new Button(11, 98, 116+38, "Rustic(C)")); + buttons.add(new Button(12, 6, 135+38, "Fade")); + buttons.add(new Button(13, 52, 135+38, "Ribbons")); + buttons.add(new Button(14, 98, 135+38, "Paper")); + buttons.add(new Button(15, 6, 154+38, "Crimson")); + buttons.add(new Button(16, 52, 154+38, "Ornate")); + buttons.add(new Button(17, 98, 154+38, "Dragon")); //Dungeon Map - buttons.add(new Button(18, 20+139, 36, "Yes/No")); + buttons.add(new Button(18, 20+139, 36, "Yes/No", options.dmEnable)); //Center - buttons.add(new Button(19, 84+139, 36, "Player/Map")); + buttons.add(new Button(19, 84+139, 36, "Player/Map", options.dmCenterPlayer)); //Rotate - buttons.add(new Button(20, 20+139, 65, "Player/No Rotate")); + buttons.add(new Button(20, 20+139, 65, "Player/No Rotate", options.dmRotatePlayer)); //Icon Style - buttons.add(new Button(21, 84+139, 65, "Default/Heads")); + buttons.add(new Button(21, 84+139, 65, "Default/Heads", options.dmPlayerHeads)); //Check Orient - buttons.add(new Button(22, 20+139, 94, "Normal/Reorient")); + buttons.add(new Button(22, 20+139, 94, "Normal/Reorient", options.dmOrientCheck)); //Check Center - buttons.add(new Button(23, 84+139, 94, "Yes/No")); + buttons.add(new Button(23, 84+139, 94, "Yes/No", options.dmCenterCheck)); //Interpolation - buttons.add(new Button(24, 20+139, 123, "Yes/No")); + buttons.add(new Button(24, 20+139, 123, "Yes/No", options.dmPlayerInterp)); //Compatibility - buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD")); + buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD", options.dmCompat)); //Background - buttons.add(new Button(26, 20+139, 152, "")); + buttons.add(new Button(26, 20+139, 152, "", options.dmBackgroundColour)); //Border - buttons.add(new Button(27, 84+139, 152, "")); + buttons.add(new Button(27, 84+139, 152, "", options.dmBorderColour)); - //Compatibility - buttons.add(new Button(28, 84+139, 181, "Normal/Scroll")); + //Chroma Mode + buttons.add(new Button(28, 84+139, 181, "Normal/Scroll", options.dmChromaBorder)); + + buttons.add(new Button(29, 52, 86+19, "XLarge", options.dmRoomSize)); + buttons.add(new Button(30, 52, 56, "XLarge", options.dmBorderSize)); xField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.manager.config.dmCenterX.value)); yField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.manager.config.dmCenterY.value)); @@ -172,6 +195,58 @@ public class GuiDungeonMapEditor extends GuiScreen { this.width = scaledResolution.getScaledWidth(); this.height = scaledResolution.getScaledHeight(); + mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth; + mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + + List<String> tooltipToDisplay = null; + for(Button button : buttons) { + if(mouseX >= guiLeft+button.x && mouseX <= guiLeft+button.x+48 && + mouseY >= guiTop+button.y-13 && mouseY <= guiTop+button.y+16) { + if(button.id >= 6 && button.id <= 17) { + String mapDesc = null; + String mapCredit = null; + int id = button.id; + switch(id) { + case 6: + mapDesc = "No Border"; break; + case 7: + mapDesc = "Used by custom Resource Packs"; break; + case 8: + mapDesc = "Simple gray border"; mapCredit = "TomEngMaster"; break; + case 9: + mapDesc = "Viney wood border"; mapCredit = "iDevil4Hell"; break; + case 10: + mapDesc = "Steampunk-inspired square border"; mapCredit = "ThatGravyBoat"; break; + case 11: + mapDesc = "Steampunk-inspired circular border"; mapCredit = "ThatGravyBoat"; break; + case 12: + mapDesc = "Light fade border"; mapCredit = "Qwiken"; break; + case 13: + mapDesc = "Simple gray border with red ribbons"; mapCredit = "Sai"; break; + case 14: + mapDesc = "Paper border"; mapCredit = "KingJames02st"; break; + case 15: + mapDesc = "Nether-inspired border"; break; + case 16: + mapDesc = "Golden ornate border"; mapCredit = "iDevil4Hell"; break; + case 17: + mapDesc = "Stone dragon border"; mapCredit = "ImperiaL"; break; + } + + ArrayList<String> tooltip = new ArrayList<>(); + tooltip.add(EnumChatFormatting.YELLOW+"Border Style"); + tooltip.add(EnumChatFormatting.AQUA+"Customize the look of the dungeon border"); + tooltip.add(""); + if(mapDesc != null) tooltip.add(EnumChatFormatting.YELLOW+"Set to: "+EnumChatFormatting.AQUA+mapDesc); + if(mapCredit != null) tooltip.add(EnumChatFormatting.YELLOW+"Artist: "+EnumChatFormatting.GOLD+mapCredit); + tooltipToDisplay = tooltip; + } else { + tooltipToDisplay = button.getTooltip(); + } + break; + } + } + this.sizeX = 431; this.sizeY = 237; this.guiLeft = (this.width - this.sizeX) / 2; @@ -192,9 +267,9 @@ public class GuiDungeonMapEditor extends GuiScreen { Utils.drawStringCenteredScaledMaxWidth("Map Border Size", Minecraft.getMinecraft().fontRendererObj, guiLeft+76, guiTop+30, false, 137, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("Map Rooms Size", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+60, false, 137, 0xFFB4B4B4); + guiLeft+76, guiTop+60+19, false, 137, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("Map Border Style", Minecraft.getMinecraft().fontRendererObj, - guiLeft+76, guiTop+90, false, 137, 0xFFB4B4B4); + guiLeft+76, guiTop+90+38, false, 137, 0xFFB4B4B4); Utils.drawStringCenteredScaledMaxWidth("Dungeon Map", Minecraft.getMinecraft().fontRendererObj, guiLeft+44+139, guiTop+30, false, 60, 0xFFB4B4B4); @@ -234,11 +309,11 @@ public class GuiDungeonMapEditor extends GuiScreen { Options options = NotEnoughUpdates.INSTANCE.manager.config; buttons.get(18).text = options.dmEnable.value ? "Enabled" : "Disabled"; buttons.get(19).text = options.dmCenterPlayer.value ? "Player" : "Map"; - buttons.get(20).text = options.dmRotatePlayer.value ? "Player" : "No Rotate"; + buttons.get(20).text = options.dmRotatePlayer.value ? "Player" : "Vertical"; buttons.get(21).text = options.dmPlayerHeads.value <= 0 ? "Default" : options.dmPlayerHeads.value >= 3 ? "SmallHeads" : options.dmPlayerHeads.value == 1 ? "Heads" : "ScaledHeads"; - buttons.get(22).text = options.dmOrientCheck.value ? "Orient" : "Default"; - buttons.get(23).text = options.dmCenterCheck.value ? "Center" : "Default"; + buttons.get(22).text = options.dmOrientCheck.value ? "Orient" : "Off"; + buttons.get(23).text = options.dmCenterCheck.value ? "Center" : "Off"; buttons.get(24).text = options.dmPlayerInterp.value ? "Interp" : "No Interp"; buttons.get(25).text = options.dmCompat.value <= 0 ? "Normal" : options.dmCompat.value >= 2 ? "No FB/SHD" : "No SHD"; @@ -269,6 +344,11 @@ public class GuiDungeonMapEditor extends GuiScreen { button.render(); } + //List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font + if(tooltipToDisplay != null) { + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, 200, Minecraft.getMinecraft().fontRendererObj); + } + if(activeColourEditor != null) { Gui.drawRect(activeColourEditor.x, activeColourEditor.y, activeColourEditor.x+119, activeColourEditor.y+89, colourEditorBG); @@ -596,12 +676,16 @@ public class GuiDungeonMapEditor extends GuiScreen { options.dmBorderSize.value = 1.0; break; case 2: options.dmBorderSize.value = 2.0; break; + case 30: + options.dmBorderSize.value = 3.0; break; case 3: options.dmRoomSize.value = 0.0; break; case 4: options.dmRoomSize.value = 1.0; break; case 5: options.dmRoomSize.value = 2.0; break; + case 29: + options.dmRoomSize.value = 3.0; break; case 18: options.dmEnable.value = !options.dmEnable.value; break; case 19: @@ -638,12 +722,17 @@ public class GuiDungeonMapEditor extends GuiScreen { private boolean isButtonPressed(int id) { Options options = NotEnoughUpdates.INSTANCE.manager.config; + if(id >= 0 && id <= 2) { return options.dmBorderSize.value == id; } else if(id >= 3 && id <= 5) { return options.dmRoomSize.value == id-3; } else if(id >= 6 && id <= 17) { return options.dmBorderStyle.value == id-6; + } else if(id == 29) { + return options.dmRoomSize.value == 3; + } else if(id == 30) { + return options.dmBorderSize.value == 3; } return false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 29a25d56..3c9f0190 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -621,7 +621,7 @@ public class NEUEventListener { } private void renderDungeonChestOverlay(GuiScreen gui) { - if(gui instanceof GuiChest && neu.manager.auctionManager.activeAuctions > 0 && !neu.manager.config.dungeonProfitLore.value) { + if(gui instanceof GuiChest && !neu.manager.config.dungeonProfitLore.value) { try { int xSize = (int) Utils.getField(GuiContainer.class, gui, "xSize", "field_146999_f"); int ySize = (int) Utils.getField(GuiContainer.class, gui, "ySize", "field_147000_g"); @@ -790,9 +790,7 @@ public class NEUEventListener { return; } if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) { - if(neu.manager.config.accessoryBagOverlay.value && AccessoryBagOverlay.mouseClick()) { - event.setCanceled(true); - } else { + if(!neu.manager.config.accessoryBagOverlay.value || !AccessoryBagOverlay.mouseClick()) { if(!(hoverInv && focusInv)) { if(neu.overlay.mouseInput()) { event.setCanceled(true); @@ -1340,21 +1338,21 @@ public class NEUEventListener { JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname); JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internalname); + int lowestBin = neu.manager.auctionManager.getLowestBin(internalname); + APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname); + boolean hasAuctionPrice = neu.manager.config.invAuctionPrice.value && auctionInfo != null; boolean hasBazaarPrice = neu.manager.config.invBazaarPrice.value && bazaarInfo != null; - - int lowestBin = neu.manager.auctionManager.getLowestBin(internalname); + boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0; NumberFormat format = NumberFormat.getInstance(Locale.US); - APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname); - - if(hasAuctionPrice || hasBazaarPrice || craftCost.fromRecipe) event.toolTip.add(""); + if(hasAuctionPrice || hasBazaarPrice || hasLowestBinPrice) event.toolTip.add(""); + if(hasLowestBinPrice) { + event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); + } if(hasAuctionPrice) { - if(lowestBin > 0) { - event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); - } int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index f0d46f7f..b2742bf9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -864,7 +864,7 @@ public class NEUOverlay extends Gui { } if(Keyboard.isKeyDown(Keyboard.KEY_Y) && manager.config.dev.value) { - //displayInformationPane(new DevInfoPane(this, manager)); + displayInformationPane(new DevInfoPane(this, manager)); //displayInformationPane(new QOLInfoPane(this, manager)); } @@ -914,16 +914,29 @@ public class NEUOverlay extends Gui { int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - iterateItemSlots(new ItemSlotConsumer() { - public void consume(int x, int y, int id) { - if (mouseX >= x - 1 && mouseX <= x + ITEM_SIZE + 1) { - if (mouseY >= y - 1 && mouseY <= y + ITEM_SIZE + 1) { - JsonObject json = getSearchedItemPage(id); - if (json != null) internalname.set(json.get("internalname").getAsString()); + 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 < selectedItemGroup.size(); i++) { + if (mouseX >= selectedX - 1 + 18 * i && mouseX <= selectedX + 17 + 18 * i) { + internalname.set(selectedItemGroup.get(i).get("internalname").getAsString()); } } } - }); + } else { + iterateItemSlots(new ItemSlotConsumer() { + public void consume(int x, int y, int id) { + if (mouseX >= x - 1 && mouseX <= x + ITEM_SIZE + 1) { + if (mouseY >= y - 1 && mouseY <= y + ITEM_SIZE + 1) { + JsonObject json = getSearchedItemPage(id); + if (json != null) internalname.set(json.get("internalname").getAsString()); + } + } + } + }); + } + Utils.pushGuiScale(-1); } @@ -1988,21 +2001,21 @@ public class NEUOverlay extends Gui { JsonObject auctionInfo = manager.auctionManager.getItemAuctionInfo(internalname); JsonObject bazaarInfo = manager.auctionManager.getBazaarInfo(internalname); + int lowestBin = manager.auctionManager.getLowestBin(internalname); + APIManager.CraftInfo craftCost = manager.auctionManager.getCraftCost(json.get("internalname").getAsString()); + boolean hasAuctionPrice = !manager.config.invAuctionPrice.value && auctionInfo != null; boolean hasBazaarPrice = !manager.config.invBazaarPrice.value && bazaarInfo != null; - - int lowestBin = manager.auctionManager.getLowestBin(internalname); + boolean hasLowestBinPrice = !manager.config.invAuctionPrice.value && lowestBin > 0; NumberFormat format = NumberFormat.getInstance(Locale.US); - APIManager.CraftInfo craftCost = manager.auctionManager.getCraftCost(json.get("internalname").getAsString()); - - if(hasAuctionPrice || hasBazaarPrice || craftCost.fromRecipe) text.add(""); + if(hasAuctionPrice || hasBazaarPrice || hasLowestBinPrice) text.add(""); + if(hasLowestBinPrice) { + text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ + EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); + } if(hasAuctionPrice) { - if(lowestBin > 0) { - text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); - } int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index fee96152..891b9711 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -87,7 +87,7 @@ import java.util.regex.Pattern; @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true) public class NotEnoughUpdates { public static final String MODID = "notenoughupdates"; - public static final String VERSION = "1.4-REL"; + public static final String VERSION = "1.5-REL"; public static NotEnoughUpdates INSTANCE = null; @@ -844,7 +844,6 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(SBInfo.getInstance()); MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE); MinecraftForge.EVENT_BUS.register(new DungeonMap()); - MinecraftForge.EVENT_BUS.register(new DumymMod()); //MinecraftForge.EVENT_BUS.register(new BetterPortals()); IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); 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 4530fc6e..886ffd73 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -39,7 +39,7 @@ public class APIManager { private HashSet<String> playerBidsNotified = new HashSet<>(); private HashSet<String> playerBidsFinishedNotified = new HashSet<>(); - private HashMap<String, TreeMap<Integer, Set<String>>> internalnameToLowestBIN = new HashMap<>(); + private JsonObject lowestBins = null; private LinkedList<Integer> pagesToDownload = null; @@ -55,6 +55,7 @@ public class APIManager { private long lastCleanup = 0; private long lastAuctionAvgUpdate = 0; private long lastBazaarUpdate = 0; + private long lastLowestBinUpdate = 0; private long lastApiUpdate = 0; private long firstHypixelApiUpdate = 0; @@ -165,7 +166,6 @@ public class APIManager { auctionMap.clear(); internalnameToAucIdMap.clear(); - internalnameToLowestBIN.clear(); extrasToAucIdMap.clear(); } @@ -174,15 +174,28 @@ public class APIManager { customAH.tick(); long currentTime = System.currentTimeMillis(); - if(currentTime - lastAuctionUpdate > 60*1000) { - lastAuctionUpdate = currentTime; - updatePageTick(); - } + if(manager.config.neuAuctionHouse.value) { + if(currentTime - lastAuctionUpdate > 60*1000) { + lastAuctionUpdate = currentTime; + updatePageTick(); + } - if(currentTime - lastShortAuctionUpdate > 10*1000) { - lastShortAuctionUpdate = currentTime; - updatePageTickShort(); - ahNotification(); + if(currentTime - lastShortAuctionUpdate > 10*1000) { + lastShortAuctionUpdate = currentTime; + updatePageTickShort(); + ahNotification(); + } + if(currentTime - lastCleanup > 60*1000) { + lastCleanup = currentTime; + cleanup(); + } + if(currentTime - lastCustomAHSearch > 60*1000) { + lastCustomAHSearch = currentTime; + if(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || customAH.isRenderOverAuctionView()) { + customAH.updateSearch(); + calculateStats(); + } + } } if(currentTime - lastAuctionAvgUpdate > 30*60*1000) { //30 minutes lastAuctionAvgUpdate = currentTime - 28*60*1000; //Try again in 2 minutes if updateAvgPrices doesn't succeed @@ -192,16 +205,9 @@ public class APIManager { lastBazaarUpdate = currentTime; updateBazaar(); } - if(currentTime - lastCleanup > 60*1000) { - lastCleanup = currentTime; - cleanup(); - } - if(currentTime - lastCustomAHSearch > 60*1000) { - lastCustomAHSearch = currentTime; - if(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || customAH.isRenderOverAuctionView()) { - customAH.updateSearch(); - calculateStats(); - } + if(currentTime - lastLowestBinUpdate > 2*60*1000) { + lastLowestBinUpdate = currentTime; + updateLowestBin(); } } @@ -222,9 +228,25 @@ public class APIManager { } public int getLowestBin(String internalname) { - TreeMap<Integer, Set<String>> lowestBIN = internalnameToLowestBIN.get(internalname); - if(lowestBIN == null || lowestBIN.isEmpty()) return -1; - return lowestBIN.firstKey(); + if(internalname.contains("AUGER")) { + System.out.println("Tried to get auger!"); + } + if(lowestBins != null && lowestBins.has(internalname)) { + JsonElement e = lowestBins.get(internalname); + if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) { + if(internalname.contains("AUGER")) { + System.out.println("s:"+e.getAsInt()); + } + return e.getAsInt(); + } + } + return -1; + } + + public void updateLowestBin() { + manager.hypixelApi.getMyApiGZIPAsync("lowestbin.json.gz", (jsonObject) -> { + lowestBins = jsonObject; + }, () -> {}); } private void ahNotification() { @@ -298,14 +320,6 @@ public class APIManager { for(HashSet<String> aucids : internalnameToAucIdMap.values()) { aucids.removeAll(toRemove); } - for(TreeMap<Integer, Set<String>> lowestBINs : internalnameToLowestBIN.values()) { - Set<Integer> toRemoveSet = new HashSet<>(); - for(Map.Entry<Integer, Set<String>> entry : lowestBINs.entrySet()) { - entry.getValue().removeAll(toRemove); - if(entry.getValue().isEmpty()) toRemoveSet.add(entry.getKey()); - } - lowestBINs.keySet().removeAll(toRemoveSet); - } } private void updatePageTickShort() { @@ -314,7 +328,7 @@ public class APIManager { if(firstHypixelApiUpdate == 0 || (System.currentTimeMillis() - firstHypixelApiUpdate)%(60*1000) > 15*1000) return; JsonObject disable = Constants.DISABLE; - if(disable != null && disable.get("auctions").getAsBoolean()) return; + if(disable != null && disable.has("auctions_new") && disable.get("auctions_new").getAsBoolean()) return; while(!pagesToDownload.isEmpty()) { try { @@ -326,7 +340,7 @@ public class APIManager { private void updatePageTick() { JsonObject disable = Constants.DISABLE; - if(disable != null && disable.get("auctions").getAsBoolean()) return; + if(disable != null && disable.has("auctions_new") && disable.get("auctions_new").getAsBoolean()) return; if(pagesToDownload == null) { getPageFromAPI(0); @@ -514,16 +528,6 @@ public class APIManager { index++; } - if(bin) { - TreeMap<Integer, Set<String>> lowestBINs = internalnameToLowestBIN.computeIfAbsent(internalname, k -> new TreeMap<>()); - 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() > 50) { - lowestBINs.keySet().remove(lowestBINs.lastKey()); - } - } - for(int j=0; j<bids.size(); j++) { JsonObject bid = bids.get(j).getAsJsonObject(); if(bid.get("bidder").getAsString().equalsIgnoreCase(playerUUID)) { 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 430584e4..42346651 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -857,28 +857,30 @@ public class CustomAH extends Gui { int maxItemScroll = Math.max(0, totalItems - (5+splits)*9); itemsScroll = Math.min(itemsScroll, maxItemScroll); - out: - for(int i=0; i<5+splits; i++) { - int itemY = guiTop + i*18 + 18; - for(int j=0; j<9; j++) { - int itemX = guiLeft + j*18 + 9; - int id = itemsScroll + i*9 + j; - if(auctionIds.size() <= id) break out; + if(manager.config.neuAuctionHouse.value) { + out: + for(int i=0; i<5+splits; i++) { + int itemY = guiTop + i*18 + 18; + for(int j=0; j<9; j++) { + int itemX = guiLeft + j*18 + 9; + int id = itemsScroll + i*9 + j; + if(auctionIds.size() <= id) break out; - try { - String aucid = sortedAuctionIds.get(id); + try { + String aucid = sortedAuctionIds.get(id); - GL11.glTranslatef(0,0,100); - ItemStack stack = manager.auctionManager.getAuctionItems().get(aucid).getStack(); - Utils.drawItemStack(stack, itemX, itemY); - GL11.glTranslatef(0,0,-100); + GL11.glTranslatef(0,0,100); + ItemStack stack = manager.auctionManager.getAuctionItems().get(aucid).getStack(); + Utils.drawItemStack(stack, itemX, itemY); + GL11.glTranslatef(0,0,-100); - if(mouseX > itemX && mouseX < itemX+16) { - if(mouseY > itemY && mouseY < itemY+16) { - tooltipToRender = getTooltipForAucId(aucid); + if(mouseX > itemX && mouseX < itemX+16) { + if(mouseY > itemY && mouseY < itemY+16) { + tooltipToRender = getTooltipForAucId(aucid); + } } + } catch(Exception e) { } - } catch(Exception e) { } } } @@ -901,6 +903,11 @@ public class CustomAH extends Gui { this.drawTexturedModalRect(guiLeft+175, guiTop+18+(int)((95+ySplitSize*2)*scrollAmount), 256-(scrollClicked?12:24), 0, 12, 15); + if(!manager.config.neuAuctionHouse.value) { + Utils.drawStringCentered(EnumChatFormatting.RED+"NEUAH is DISABLED! Enable in /neusettings.", + Minecraft.getMinecraft().fontRendererObj, guiLeft+getXSize()/2, guiTop+getYSize()/2-5, true, 0); + } + if(tooltipToRender != null) { List<String> tooltipGray = new ArrayList<>(); for(String line : tooltipToRender) { @@ -1044,6 +1051,10 @@ public class CustomAH extends Gui { } public void handleMouseInput() { + if(!manager.config.neuAuctionHouse.value) { + return; + } + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); @@ -1201,6 +1212,10 @@ public class CustomAH extends Gui { private ExecutorService es = Executors.newSingleThreadExecutor(); public void updateSearch() { + if(!manager.config.neuAuctionHouse.value) { + return; + } + if(searchField == null || priceField == null) init(); long currentTime = System.currentTimeMillis(); @@ -1305,6 +1320,10 @@ public class CustomAH extends Gui { } public void sortItems() throws ConcurrentModificationException { + if(!manager.config.neuAuctionHouse.value) { + return; + } + try { List<String> sortedAuctionIdsNew = new ArrayList<>(); @@ -1352,6 +1371,10 @@ public class CustomAH extends Gui { } public boolean keyboardInput() { + if(!manager.config.neuAuctionHouse.value) { + return false; + } + Keyboard.enableRepeatEvents(true); if(isEditingPrice() && Keyboard.getEventKey() == Keyboard.KEY_RETURN) { Minecraft.getMinecraft().displayGuiScreen(null); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index ee8282e9..2290e4a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -102,10 +102,12 @@ public abstract class MixinGuiContainer { 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()))) { + System.out.println("handling click"); BetterContainers.clickSlot(slotIn.getSlotIndex()); Utils.playPressSound(); if(BetterContainers.isBlankStack(slotIn.getStack())) { + System.out.println("cancelling click"); 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/mixins/MixinRenderFish.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java new file mode 100644 index 00000000..59ce4852 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java @@ -0,0 +1,134 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.SpecialColour; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderFish; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.init.Items; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; +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; + +import java.awt.*; + +@Mixin(RenderFish.class) +public abstract class MixinRenderFish extends Render<EntityFishHook> { + + protected MixinRenderFish(RenderManager renderManager) { + super(renderManager); + } + + @Inject(method = "doRender(Lnet/minecraft/entity/projectile/EntityFishHook;DDDFF)V", at=@At(value = "HEAD"), cancellable = true) + public void render(EntityFishHook entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { + if(!NotEnoughUpdates.INSTANCE.manager.config.rodColours.value || entity == null) return; + + String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(entity.angler.getHeldItem()); + if (NotEnoughUpdates.INSTANCE.isOnSkyblock() && internalname != null && entity.angler != null && + entity.angler.getHeldItem().getItem().equals(Items.fishing_rod)) { + if (!internalname.equals("GRAPPLING_HOOK") && !internalname.endsWith("_WHIP")) { + ci.cancel(); + + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + this.bindEntityTexture(entity); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL); + worldrenderer.pos(-0.5D, -0.5D, 0.0D).tex(0.0625D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, -0.5D, 0.0D).tex(0.125D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, 0.5D, 0.0D).tex(0.125D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(-0.5D, 0.5D, 0.0D).tex(0.0625D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex(); + tessellator.draw(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + + if (entity.angler != null) { + float f7 = entity.angler.getSwingProgress(partialTicks); + float f8 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float)Math.PI); + + double d0; + double d1; + double d2; + double d3; + if(this.renderManager.options.thirdPersonView == 0 && entity.angler == Minecraft.getMinecraft().thePlayer) { + double fov = this.renderManager.options.fovSetting; + fov = fov / 90.0; + double xFactor = 0.5 + 0.55*((fov-0.333)/0.889); + Vec3 vec3 = new Vec3(-xFactor * fov, -0.045D * fov, 0.4D); + vec3 = vec3.rotatePitch(-(entity.angler.prevRotationPitch + (entity.angler.rotationPitch - entity.angler.prevRotationPitch) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(-(entity.angler.prevRotationYaw + (entity.angler.rotationYaw - entity.angler.prevRotationYaw) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(f8 * 0.5F); + vec3 = vec3.rotatePitch(-f8 * 0.7F); + d0 = entity.angler.prevPosX + (entity.angler.posX - entity.angler.prevPosX) * (double)partialTicks + vec3.xCoord; + d1 = entity.angler.prevPosY + (entity.angler.posY - entity.angler.prevPosY) * (double)partialTicks + vec3.yCoord; + d2 = entity.angler.prevPosZ + (entity.angler.posZ - entity.angler.prevPosZ) * (double)partialTicks + vec3.zCoord; + d3 = entity.angler.getEyeHeight(); + } else { + float f9 = (entity.angler.prevRenderYawOffset + (entity.angler.renderYawOffset - entity.angler.prevRenderYawOffset) * partialTicks) * (float)Math.PI / 180.0F; + double d4 = MathHelper.sin(f9); + double d6 = MathHelper.cos(f9); + d0 = entity.angler.prevPosX + (entity.angler.posX - entity.angler.prevPosX) * (double)partialTicks - d6 * 0.35D - d4 * 0.8D; + d1 = entity.angler.prevPosY + entity.angler.getEyeHeight() + (entity.angler.posY - entity.angler.prevPosY) * (double)partialTicks - 0.45D; + d2 = entity.angler.prevPosZ + (entity.angler.posZ - entity.angler.prevPosZ) * (double)partialTicks - d4 * 0.35D + d6 * 0.8D; + d3 = entity.angler.isSneaking() ? -0.1875D : 0.0D; + } + + double d13 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + double d5 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + 0.25D; + double d7 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + double d9 = (double)((float)(d0 - d13)); + double d11 = (double)((float)(d1 - d5)) + d3; + double d12 = (double)((float)(d2 - d7)); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR); + + String specialColour; + if (entity.angler.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { + specialColour = NotEnoughUpdates.INSTANCE.manager.config.selfRodLineColour.value; + } else { + specialColour = NotEnoughUpdates.INSTANCE.manager.config.otherRodLineColour.value; + } + int colourI = SpecialColour.specialToChromaRGB(specialColour); + + for (int l = 0; l <= 16; ++l) { + if(SpecialColour.getSpeed(specialColour) > 0) { //has chroma + colourI = SpecialColour.rotateHue(colourI, 10); + } + Color colour = new Color(colourI, true); + + float f10 = (float)l / 16.0F; + worldrenderer.pos(x + d9 * (double)f10, y + d11 * (double)(f10 * f10 + f10) * 0.5D + 0.25D, z + d12 * (double)f10) + .color(colour.getRed(), colour.getGreen(), colour.getBlue(), colour.getAlpha()).endVertex(); + } + + tessellator.draw(); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + } + } + } + +}
\ No newline at end of file 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 f6ce41dd..adaf1ad0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java @@ -185,20 +185,32 @@ public class Options { false, "If true, will show the overlay for cracked bricks, etc. even when not in dungeons.", CAT_MISC); public Option<Boolean> disableDungeonBlocks = new Option( - false, + true, "Disables the dungeon blocks feature", false, - "If true, the dungeon block overlay will be disabled.", CAT_FEATURES); + "If true, the dungeon block overlay will be disabled. WARNING: May cause memory/fps issues on some machines", CAT_FEATURES); public Option<Boolean> missingEnchantList = new Option( true, "Missing Enchant List", false, "If true, will show enchants that are missing on an enchanted item when LSHIFT is pressed.", CAT_FEATURES); + public Option<Boolean> neuAuctionHouse = new Option( + false, + "NEU Auction House", + false, + "Enables the auction house which can be found using /neuah.\n" + + "Don't enable this option unless you use /neuah\n" + + "You *may* need to restart after enabling this for the auctions to download properly", CAT_FEATURES); public Option<Boolean> accessoryBagOverlay = new Option( true, "Accessory Bag Overlay", false, "If true, will an overlay with useful information in your accessory bag.", CAT_FEATURES); + public Option<Boolean> rodColours = new Option( + true, + "Custom Rod Line Colours", + false, + "If true, will use custom colours for fishing line rods in skyblock.", CAT_FEATURES); public Option<Double> paneGuiScale = new Option( 0.0, "Pane GUI Scale", @@ -312,6 +324,18 @@ public class Options { false, "Dungeon Bat Colour", FLAG_COLOUR, CAT_COLOURS); + public Option<String> selfRodLineColour = new Option( + "0:255:0:0:0", + "Your Rod Line Colour", + false, + "Changes the colour of your rod's fishing line.\nContrib: ThatGravyBoat", + FLAG_COLOUR, CAT_COLOURS); + public Option<String> otherRodLineColour = new Option( + "0:255:0:0:0", + "Other Rod Line Colour", + false, + "Changes the colour of other players' rod's fishing line.\nContrib: ThatGravyBoat", + FLAG_COLOUR, CAT_COLOURS); /** * OPTIONS THAT DON'T SHOW IN GUI @@ -396,89 +420,89 @@ public class Options { //Dungeon Map Options public Option<Double> dmBorderSize = new Option( 1.0, - "dmBorderSize", + "Border Size", false, - "", CAT_ALL); + "Changes the size of the map border, without changing the size of the contents\nSmall = 90x\nMedium = 120x\nLarge = 160x", CAT_ALL); public Option<Double> dmRoomSize = new Option( 1.0, - "dmRoomSize", + "Room Size", false, - "", CAT_ALL); + "Changes the size of rooms. Useful for higher dungeons with larger maps\nSmall = 12x\nMedium = 16x\nLarge = 20x\nXLarge = 24x", CAT_ALL); public Option<Double> dmBorderStyle = new Option( 0.0, - "dmBorderStyle", + "Border Style", false, - "", CAT_ALL); + "Various custom borders from various talented artists.\nUse 'custom' if your texture pack has a custom border", CAT_ALL); public Option<Boolean> dmEnable = new Option( true, - "dmEnable", + "Show Dungeon Map", false, - "", CAT_ALL); + "Show/hide the NEU dungeon map", CAT_ALL); public Option<Boolean> dmCenterPlayer = new Option( false, - "dmCenterPlayer", + "Map Center", false, - "", CAT_ALL); + "Center on rooms, or center on your player", CAT_ALL); public Option<Boolean> dmRotatePlayer = new Option( true, - "dmCenterPlayer", + "Rotate with Player", false, - "", CAT_ALL); + "Rotate the map to face the same direction as your player", CAT_ALL); public Option<Boolean> dmOrientCheck = new Option( true, - "dmOrientCheck", + "Orient Checkmarks", false, - "", CAT_ALL); + "Checkmarks will always show vertically, regardless of rotation", CAT_ALL); public Option<Boolean> dmCenterCheck = new Option( false, - "dmOrientCheck", + "Center Checkmarks", false, - "", CAT_ALL); + "Checkmarks will show closer to the center of rooms", CAT_ALL); public Option<Double> dmPlayerHeads = new Option( 0.0, - "dmPlayerHeads", + "Player Icon Style", false, - "", CAT_ALL); + "Various player icon styles", CAT_ALL); public Option<Boolean> dmPlayerInterp = new Option( true, - "dmPlayerInterp", + "Interpolate Far Players", false, - "", CAT_ALL); + "Will make players far away move smoothly", CAT_ALL); public Option<Double> dmCompat = new Option( 0.0, - "dmCompat", + "OpenGL Compatibility", false, - "", CAT_ALL); + "Compatiblity options for people with bad computers. ONLY use this if you know what you are doing, otherwise the map will look worse", CAT_ALL); public Option<String> dmBackgroundColour = new Option( "00:170:75:75:75", - "dmBackgroundColour", + "Background Colour", false, - "", FLAG_COLOUR, CAT_ALL); + "Colour of the map background. Supports opacity & chroma", FLAG_COLOUR, CAT_ALL); public Option<String> dmBorderColour = new Option( "00:0:0:0:0", - "dmBorderColour", + "Border Colour", false, - "", FLAG_COLOUR, CAT_ALL); + "Colour of the map border. Supports opacity & chroma. Turn off custom borders to see", FLAG_COLOUR, CAT_ALL); public Option<Boolean> dmChromaBorder = new Option( false, - "dmChromaBorder", + "Chroma Border Mode", false, - "", CAT_ALL); + "Applies a hue offset around the map border", CAT_ALL); public Option<Double> dmBackgroundBlur = new Option( 3.0, - "dmBackgroundBlur", + "Background Blur Factor", false, - "", CAT_ALL); + "Changes the blur factor behind the map. Set to 0 to disable blur", CAT_ALL); public Option<Double> dmCenterX = new Option( 8.5, - "dmCenterX", + "Center X (%)", false, - "", CAT_ALL); + "The horizontal position of the map", CAT_ALL); public Option<Double> dmCenterY = new Option( 15.0, - "dmCenterY", + "Center Y (%)", false, - "", CAT_ALL); + "The vertical position of the map", CAT_ALL); private ArrayList<String> createDefaultQuickCommands() { ArrayList<String> arr = new ArrayList<>(); @@ -575,12 +599,13 @@ public class Options { tryAddOption(disableDungeonBlocks, options); tryAddOption(missingEnchantList, options); tryAddOption(accessoryBagOverlay, options); + tryAddOption(rodColours, options); + tryAddOption(neuAuctionHouse, options); //Sliders tryAddOption(paneGuiScale, options); tryAddOption(smoothAoteMillis, options); tryAddOption(bgBlurFactor, options); tryAddOption(ahNotification, options); - tryAddOption(itemHighlightOpacity, options); tryAddOption(panePadding, options); tryAddOption(tooltipBorderOpacity, options); tryAddOption(dynamicMenuBackgroundStyle, options); @@ -593,6 +618,8 @@ public class Options { tryAddOption(itemFavouriteColour, options); tryAddOption(treecapOverlayColour, options); tryAddOption(wandOverlayColour, options); + tryAddOption(selfRodLineColour, options); + tryAddOption(otherRodLineColour, options); tryAddOption(dungCrackedColour, options); tryAddOption(dungDispenserColour, 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 111ebea1..8e3a5015 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1670,6 +1670,7 @@ public class GuiProfileViewer extends GuiScreen { guiLeft+xStart, guiTop+yStartBottom, 76); if(skillInfo != null) { float totalSkillLVL = 0; + float totalTrueSkillLVL = 0; float totalSlayerLVL = 0; float totalSkillCount = 0; float totalSlayerCount = 0; @@ -1678,7 +1679,10 @@ public class GuiProfileViewer extends GuiScreen { if(entry.getKey().startsWith("level_skill")) { if(entry.getKey().contains("runecrafting")) continue; if(entry.getKey().contains("carpentry")) continue; + if(entry.getKey().contains("catacombs")) continue; + totalSkillLVL += entry.getValue().getAsFloat(); + totalTrueSkillLVL += Math.floor(entry.getValue().getAsFloat()); totalSkillCount++; } else if(entry.getKey().startsWith("level_slayer")) { totalSlayerLVL += entry.getValue().getAsFloat(); @@ -1687,12 +1691,15 @@ public class GuiProfileViewer extends GuiScreen { } float avgSkillLVL = totalSkillLVL/totalSkillCount; + float avgTrueSkillLVL = totalTrueSkillLVL/totalSkillCount; float avgSlayerLVL = totalSlayerLVL/totalSlayerCount; renderAlignedString(EnumChatFormatting.RED+"AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSkillLVL*10)/10, guiLeft+xStart, guiTop+yStartBottom+yOffset, 76); renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76); + renderAlignedString(EnumChatFormatting.RED+"True AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgTrueSkillLVL*10)/10, + guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76); } |