diff options
Diffstat (limited to 'src/main/java/io')
16 files changed, 601 insertions, 131 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index adf204d1..4ba2cba9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -4,9 +4,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; +import io.github.moulberry.notenoughupdates.core.util.MiscUtils; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks; import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; @@ -36,6 +39,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTUtil; import net.minecraft.util.*; import net.minecraftforge.client.event.*; import net.minecraftforge.event.entity.player.EntityInteractEvent; @@ -1318,6 +1322,8 @@ public class NEUEventListener { private boolean pressedArrowLast = false; private boolean pressedShiftLast = false; + private boolean copied = false; + @SubscribeEvent(priority = EventPriority.LOW) public void onItemTooltipLow(ItemTooltipEvent event) { if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return; @@ -1573,6 +1579,9 @@ public class NEUEventListener { String comparator = GuiEnchantColour.getColourOpIndex(colourOps, 1); String comparison = GuiEnchantColour.getColourOpIndex(colourOps, 2); String colourCode = GuiEnchantColour.getColourOpIndex(colourOps, 3); + String modifier = GuiEnchantColour.getColourOpIndex(colourOps, 4); + + int modifierI = GuiEnchantColour.getIntModifier(modifier); if(enchantName.length() == 0) continue; if(comparator.length() == 0) continue; @@ -1663,18 +1672,40 @@ public class NEUEventListener { } } if(matches) { + String enchantText = matcher.group(2); + StringBuilder extraModifiersBuilder = new StringBuilder(); + + if((modifierI & GuiEnchantColour.BOLD_MODIFIER) != 0) { + extraModifiersBuilder.append(EnumChatFormatting.BOLD); + } + if((modifierI & GuiEnchantColour.ITALIC_MODIFIER) != 0) { + extraModifiersBuilder.append(EnumChatFormatting.ITALIC); + } + if((modifierI & GuiEnchantColour.UNDERLINE_MODIFIER) != 0) { + extraModifiersBuilder.append(EnumChatFormatting.UNDERLINE); + } + if((modifierI & GuiEnchantColour.OBFUSCATED_MODIFIER) != 0) { + extraModifiersBuilder.append(EnumChatFormatting.OBFUSCATED); + } + if((modifierI & GuiEnchantColour.STRIKETHROUGH_MODIFIER) != 0) { + extraModifiersBuilder.append(EnumChatFormatting.STRIKETHROUGH); + } + + String extraMods = extraModifiersBuilder.toString(); + if(!colourCode.equals("z")) { - line = line.replace("\u00A79"+matcher.group(2), "\u00A7"+colourCode+matcher.group(2)); - line = line.replace("\u00A79\u00A7d\u00A7l"+matcher.group(2), "\u00A7"+colourCode+ - EnumChatFormatting.BOLD+matcher.group(2)); + line = line.replace("\u00A79"+enchantText, + "\u00A7"+colourCode+extraMods+enchantText); + line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, + "\u00A7"+colourCode+extraMods+enchantText); } else { int offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll( - "\\u00A79"+matcher.group(2)+".*", "")); - line = line.replace("\u00A79"+matcher.group(2), Utils.chromaString(matcher.group(2), offset/12f+index, false)); + "\\u00A79"+enchantText+".*", "")); + line = line.replace("\u00A79"+enchantText, Utils.chromaString(enchantText, offset/12f+index, false)); offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll( - "\\u00A79\\u00A7d\\u00A7l"+matcher.group(2)+".*", "")); - line = line.replace("\u00A79\u00A7d\u00A7l"+matcher.group(2), Utils.chromaString(matcher.group(2), + "\\u00A79\\u00A7d\\u00A7l"+enchantText+".*", "")); + line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText, offset/12f+index, true)); } } @@ -1924,8 +1955,8 @@ public class NEUEventListener { } } }*/ - if(!Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || !neu.config.hidden.dev) return; - if(event.toolTip.size()>0&&event.toolTip.get(event.toolTip.size()-1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) { + if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && neu.config.hidden.dev && + event.toolTip.size()>0&&event.toolTip.get(event.toolTip.size()-1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) { event.toolTip.remove(event.toolTip.size()-1); StringBuilder sb = new StringBuilder(); @@ -1954,8 +1985,60 @@ public class NEUEventListener { } event.toolTip.add(sb.toString()); if(Keyboard.isKeyDown(Keyboard.KEY_H)) { - StringSelection selection = new StringSelection(sb.toString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); + if(!copied) { + copied = true; + StringSelection selection = new StringSelection(sb.toString()); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); + } + } else { + copied = false; + } + } else if(NotEnoughUpdates.INSTANCE.packDevEnabled) { + event.toolTip.add(""); + event.toolTip.add(EnumChatFormatting.AQUA+"NEU Pack Dev Info:"); + event.toolTip.add("Press "+EnumChatFormatting.GOLD+"[KEY]"+EnumChatFormatting.GRAY+" to copy line"); + + String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); + + boolean k = Keyboard.isKeyDown(Keyboard.KEY_K); + boolean m = Keyboard.isKeyDown(Keyboard.KEY_M); + boolean n = Keyboard.isKeyDown(Keyboard.KEY_N); + + event.toolTip.add(EnumChatFormatting.AQUA+"Internal Name: "+EnumChatFormatting.GRAY+internal+EnumChatFormatting.GOLD+" [K]"); + if(!copied && k) { + MiscUtils.copyToClipboard(internal); + } + + if(event.itemStack.getTagCompound() != null) { + NBTTagCompound tag = event.itemStack.getTagCompound(); + + if (tag.hasKey("SkullOwner", 10)) { + GameProfile gameprofile = NBTUtil.readGameProfileFromNBT(tag.getCompoundTag("SkullOwner")); + + if(gameprofile != null) { + event.toolTip.add(EnumChatFormatting.AQUA+"Skull UUID: "+EnumChatFormatting.GRAY+gameprofile.getId()+EnumChatFormatting.GOLD+" [M]"); + if(!copied && m) { + MiscUtils.copyToClipboard(gameprofile.getId().toString()); + } + + Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Minecraft.getMinecraft().getSkinManager().loadSkinFromCache(gameprofile); + + if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) { + MinecraftProfileTexture profTex = map.get(MinecraftProfileTexture.Type.SKIN); + event.toolTip.add(EnumChatFormatting.AQUA+"Skull Texture Link: "+EnumChatFormatting.GRAY+profTex.getUrl()+EnumChatFormatting.GOLD+" [N]"); + + if(!copied && n) { + MiscUtils.copyToClipboard(profTex.getUrl()); + } + } + } + } + } + + if(k || m || n) { + copied = true; + } else { + copied = false; } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 55ba7756..447dc8d1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -668,6 +668,52 @@ public class NotEnoughUpdates { } }); + private static final String[] devFailStrings = {"No.", "I said no.", "You aren't allowed to use this.", + "Are you sure you want to use this? Type 'Yes' in chat.", "Lmao you thought", "Ok please stop", + "What do you want from me?", "This command almost certainly does nothing useful for you", + "Ok, this is the last message, after this it will repeat", "No.", "Dammit. I thought that would work. Uhh...", + "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you", + "Ok, this is actually the last message, use the command again and you'll crash I promise"}; + private int devFailIndex = 0; + SimpleCommand devTestCommand = new SimpleCommand("neudevtest", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("Moulberry")) { + if(devFailIndex >= devFailStrings.length) { + throw new Error("L") { + @Override + public void printStackTrace() { + throw new Error("Double L"); + } + }; + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+devFailStrings[devFailIndex++])); + return; + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Executing dubious code")); + /*Minecraft.getMinecraft().thePlayer.rotationYaw = 0; + Minecraft.getMinecraft().thePlayer.rotationPitch = 0; + Minecraft.getMinecraft().thePlayer.setPosition( + Math.floor(Minecraft.getMinecraft().thePlayer.posX) + Float.parseFloat(args[0]), + Minecraft.getMinecraft().thePlayer.posY, + Minecraft.getMinecraft().thePlayer.posZ);*/ + //Hot reload me yay! + } + }); + + public boolean packDevEnabled = false; + SimpleCommand packDevCommand = new SimpleCommand("neupackdev", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + packDevEnabled = !packDevEnabled; + if(packDevEnabled) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Enabled pack developer mode.")); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Disabled pack developer mode.")); + } + } + }); + SimpleCommand dnCommand = new SimpleCommand("dn", new SimpleCommand.ProcessCommandRunnable() { @Override public void processCommand(ICommandSender sender, String[] args) { @@ -888,8 +934,6 @@ public class NotEnoughUpdates { String uuid = Minecraft.getMinecraft().getSession().getPlayerID(); if(uuid.equalsIgnoreCase("ea9b1c5a-bf68-4fa2-9492-2d4e69693228")) throw new RuntimeException("Ding-dong, racism is wrong."); - if(uuid.equalsIgnoreCase("1f4bc571-783a-490a-8ef6-54d18bb72c7c")) throw new RuntimeException("Oops misclicked"); - if(uuid.equalsIgnoreCase("784747a0-3ac9-4ad6-bc75-8cf1bc9d7080")) throw new RuntimeException("Oops did it again"); neuDir = new File(event.getModConfigurationDirectory(), "notenoughupdates"); neuDir.mkdirs(); @@ -945,6 +989,8 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); ClientCommandHandler.instance.registerCommand(dhCommand); ClientCommandHandler.instance.registerCommand(dnCommand); + ClientCommandHandler.instance.registerCommand(devTestCommand); + ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); ClientCommandHandler.instance.registerCommand(peekCommand); ClientCommandHandler.instance.registerCommand(tutorialCommand); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index c0f48b87..6bd8418d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -43,7 +43,7 @@ public class CapeManager { private boolean allAvailable = false; private HashSet<String> availableCapes = new HashSet<>(); - private JsonObject lastJsonSync = null; + public JsonObject lastJsonSync = null; private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void", "ironmoon", "krusty", "furf" }; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java index f6b5b722..019fe9ee 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java @@ -1149,6 +1149,7 @@ public class DungeonMap { } } } + actualPlayers.add(Minecraft.getMinecraft().thePlayer.getName()); playerEntityMapPositions.clear(); if(usePlayerPositions) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index e198e8e5..8eb3430b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -14,6 +14,9 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -47,6 +50,11 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; + private boolean heldBonemerang = false; + + public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>(); + public boolean bonemerangBreak = false; + public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -150,84 +158,150 @@ public class CustomItemEffects { } @SubscribeEvent - public void onOverlayDrawn(RenderGameOverlayEvent event) { - if(NotEnoughUpdates.INSTANCE.config.builderWand.enableWandOverlay && - Minecraft.getMinecraft().objectMouseOver != null && - Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && - ((event.type == null && Loader.isModLoaded("labymod")) || - event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS)) { + public void onGameTick(TickEvent.ClientTickEvent event) { + if(event.phase != TickEvent.Phase.END) return; - IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( - Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( - Minecraft.getMinecraft().objectMouseOver.sideHit, 1)); - if(hover.getBlock() == Blocks.air) { - ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + heldBonemerang = false; + bonemerangBreak = false; + bonemeragedEntities.clear(); + if(Minecraft.getMinecraft().thePlayer == null) return; + if(Minecraft.getMinecraft().theWorld == null) return; - if(heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - HashSet<BlockPos> candidatesOld = new HashSet<>(); - TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>(); - - IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos()); - Item matchItem = Item.getItemFromBlock(match.getBlock()); - if(matchItem != null) { - ItemStack matchStack = new ItemStack(matchItem, 1, - match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().objectMouseOver.getBlockPos())); - - getBuildersWandCandidates(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().objectMouseOver, event.partialTicks, - candidatesOld, candidatesOldSorted, 999-MAX_BUILDERS_BLOCKS); - - boolean usingDirtWand = false; - int itemCount; - if(match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { - itemCount = candidatesOld.size(); - usingDirtWand = true; - } else { - itemCount = countItemsInInventoryAndStorage(matchStack); - } + String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + if(internal != null && internal.equals("BONE_BOOMERANG")) { + heldBonemerang = true; + + EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; + float stepSize = 0.15f; + float bonemerangDistance = 15; + + Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ); + Vec3 look = p.getLook(0); + + Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord); + step.scale(stepSize / step.length()); + + for(int i=0; i<Math.floor(bonemerangDistance/stepSize)-2; i++) { + AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.75f, position.y - 0.1, position.z - 0.75f, + position.x + 0.75f, position.y + 0.25, position.z + 0.75); - if(candidatesOld.size() > MAX_BUILDERS_BLOCKS) { - Utils.drawStringCentered(EnumChatFormatting.RED.toString()+candidatesOld.size()+"/"+MAX_BUILDERS_BLOCKS, - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); - } else { - String pre = EnumChatFormatting.GREEN.toString(); - if(itemCount < candidatesOld.size()) { - pre = EnumChatFormatting.RED.toString(); + BlockPos blockPos = new BlockPos(position.x, position.y, position.z); + + if(!Minecraft.getMinecraft().theWorld.isAirBlock(blockPos) && + Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock().isFullCube()) { + if(NotEnoughUpdates.INSTANCE.config.bonemerangOverlay.showBreak) { + bonemerangBreak = true; + } + break; + } + + if(NotEnoughUpdates.INSTANCE.config.bonemerangOverlay.highlightTargeted) { + List<Entity> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); + for(Entity entity : entities) { + if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand)) { + if(!bonemeragedEntities.contains(entity)) { + bonemeragedEntities.add((EntityLivingBase)entity); } - Utils.drawStringCentered(pre+Math.min(candidatesOld.size(), itemCount)+"/"+ - Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS), - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); } + } + } + + position.translate(step.x, step.y, step.z); + } + } + - String itemCountS = EnumChatFormatting.DARK_GRAY+"x"+EnumChatFormatting.RESET+itemCount; - int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS); - - if(NotEnoughUpdates.INSTANCE.config.builderWand.wandBlockCount) { - if(usingDirtWand) { - Utils.drawItemStack(new ItemStack(Items.gold_nugget), scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, - scaledResolution.getScaledHeight()/2+10+4); - Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, - scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+11, scaledResolution.getScaledHeight()/2f+10+8, - -1, - true); + } + + @SubscribeEvent + public void onOverlayDrawn(RenderGameOverlayEvent.Post event) { + if(((event.type == null && Loader.isModLoaded("labymod")) || + event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS)) { + if(heldBonemerang) { + if(bonemerangBreak) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + Utils.drawStringCentered(EnumChatFormatting.RED+"Bonemerang will break!", + Minecraft.getMinecraft().fontRendererObj, + scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + } + } else if(NotEnoughUpdates.INSTANCE.config.builderWand.enableWandOverlay && + Minecraft.getMinecraft().objectMouseOver != null && + Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + + IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( + Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( + Minecraft.getMinecraft().objectMouseOver.sideHit, 1)); + if(hover.getBlock() == Blocks.air) { + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + + if(heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + + HashSet<BlockPos> candidatesOld = new HashSet<>(); + TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>(); + + IBlockState match = Minecraft.getMinecraft().theWorld.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos()); + Item matchItem = Item.getItemFromBlock(match.getBlock()); + if(matchItem != null) { + ItemStack matchStack = new ItemStack(matchItem, 1, + match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().objectMouseOver.getBlockPos())); + + getBuildersWandCandidates(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().objectMouseOver, event.partialTicks, + candidatesOld, candidatesOldSorted, 999-MAX_BUILDERS_BLOCKS); + + boolean usingDirtWand = false; + int itemCount; + if(match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) { + itemCount = candidatesOld.size(); + usingDirtWand = true; } else { - Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, - scaledResolution.getScaledHeight()/2+10+4); - Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, - scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+16, scaledResolution.getScaledHeight()/2f+10+8, - -1, - true); + itemCount = countItemsInInventoryAndStorage(matchStack); } + if(candidatesOld.size() > MAX_BUILDERS_BLOCKS) { + Utils.drawStringCentered(EnumChatFormatting.RED.toString()+candidatesOld.size()+"/"+MAX_BUILDERS_BLOCKS, + Minecraft.getMinecraft().fontRendererObj, + scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + } else { + String pre = EnumChatFormatting.GREEN.toString(); + if(itemCount < candidatesOld.size()) { + pre = EnumChatFormatting.RED.toString(); + } + Utils.drawStringCentered(pre+Math.min(candidatesOld.size(), itemCount)+"/"+ + Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS), + Minecraft.getMinecraft().fontRendererObj, + scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + } + + String itemCountS = EnumChatFormatting.DARK_GRAY+"x"+EnumChatFormatting.RESET+itemCount; + int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS); + + if(NotEnoughUpdates.INSTANCE.config.builderWand.wandBlockCount) { + if(usingDirtWand) { + Utils.drawItemStack(new ItemStack(Items.gold_nugget), scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, + scaledResolution.getScaledHeight()/2+10+4); + Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, + scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+11, scaledResolution.getScaledHeight()/2f+10+8, + -1, + true); + } else { + Utils.drawItemStack(matchStack, scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2, + scaledResolution.getScaledHeight()/2+10+4); + Minecraft.getMinecraft().fontRendererObj.drawString(itemCountS, + scaledResolution.getScaledWidth()/2f - (itemCountLen+16)/2f+16, scaledResolution.getScaledHeight()/2f+10+8, + -1, + true); + } + + } + + GlStateManager.color(1, 1, 1, 1); } - GlStateManager.color(1, 1, 1, 1); } - } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java index 30b99e1c..e4b4fff9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java @@ -103,6 +103,8 @@ public class CustomSkulls implements IResourceManagerReloadListener { CustomSkull skull = new CustomSkull(); skull.texture = loc; + Minecraft.getMinecraft().getTextureManager().deleteTexture(skull.texture); + customSkulls.put(entry.getKey(), skull); } } @@ -118,7 +120,6 @@ public class CustomSkulls implements IResourceManagerReloadListener { Minecraft.getMinecraft().getTextureManager().loadTickableTexture(atlas, textureMap); } catch(Exception e) { - e.printStackTrace(); } } @@ -217,7 +218,10 @@ public class CustomSkulls implements IResourceManagerReloadListener { public boolean renderSkull(float xOffset, float yOffset, float zOffset, EnumFacing placedDirection, float rotationDeg, int skullType, GameProfile skullOwner, int damage) { - if(skullOwner == null || placedDirection != EnumFacing.UP || skullType != 3) { + if(placedDirection != EnumFacing.UP || skullType != 3) { + return false; + } + if(skullOwner == null || skullOwner.getId() == null) { return false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java index a3f6dbf4..c2f778a5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java @@ -2,7 +2,6 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -21,7 +20,7 @@ public class DamageCommas { } public static IChatComponent replaceName(IChatComponent name) { - if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 0) return name; + if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 0) return name; String formatted = name.getFormattedText(); int hashCode = formatted.hashCode(); @@ -35,7 +34,7 @@ public class DamageCommas { if(formatted.length() >= 7 && formatted.startsWith("\u00A7f\u2727") && formatted.endsWith("\u2727\u00a7r")) { - if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 2) { + if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2) { String numbers = Utils.cleanColour(formatted.substring(3, formatted.length()-3)).trim().replaceAll("[^0-9]", ""); try { int damage = Integer.parseInt(numbers); @@ -116,7 +115,7 @@ public class DamageCommas { int damage = Integer.parseInt(damageS); String damageFormatted; - if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 2 && damage > 999) { + if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2 && damage > 999) { damageFormatted = Utils.shortNumberFormat(damage, 0); } else { damageFormatted = NumberFormat.getIntegerInstance().format(damage); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java index a60307d2..9a648221 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java @@ -92,6 +92,7 @@ public class DwarvenMinesWaypoints { private long dynamicMillis = 0; private String dynamicLocation = null; + private String dynamicName = null; private final Pattern ghastRegex = Pattern.compile("\u00A7r\u00A7eFind the \u00A7r\u00A76Powder Ghast\u00A7r\u00A7e near the \u00A7r\u00A7b(.+)!"); private final Pattern fallenStarRegex = Pattern.compile("\u00A7r\u00A75Fallen Star \u00A7r\u00A7ehas crashed at \u00A7r\u00A7b(.+)\u00A7r\u00A7e!"); @@ -100,11 +101,13 @@ public class DwarvenMinesWaypoints { Matcher matcherGhast = ghastRegex.matcher(event.message.getFormattedText()); if(matcherGhast.find()) { dynamicLocation = Utils.cleanColour(matcherGhast.group(1).trim()); + dynamicName = EnumChatFormatting.GOLD+"Powder Ghast"; dynamicMillis = System.currentTimeMillis(); } else { Matcher matcherStar = fallenStarRegex.matcher(event.message.getFormattedText()); if(matcherStar.find()) { dynamicLocation = Utils.cleanColour(matcherStar.group(1).trim()); + dynamicName = EnumChatFormatting.DARK_PURPLE+"Fallen Star"; dynamicMillis = System.currentTimeMillis(); } } @@ -185,12 +188,11 @@ public class DwarvenMinesWaypoints { int locWaypoint = NotEnoughUpdates.INSTANCE.config.mining.locWaypoints; - if(dynamicLocation != null && + if(dynamicLocation != null && dynamicName != null && System.currentTimeMillis() - dynamicMillis < 30*1000) { for(Map.Entry<String, Vector3f> entry : waypointsMap.entrySet()) { if(entry.getKey().equals(dynamicLocation)) { - renderWayPoint(EnumChatFormatting.GOLD+"Powder Ghast", - new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); + renderWayPoint(dynamicName, new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); break; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 51a9dcd6..b3ce3835 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -19,6 +19,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -96,6 +97,8 @@ public class PetInfoOverlay extends TextOverlay { private float xpGainHourLast = -1; private float xpGainHour = -1; + private int xpAddTimer = 0; + public static void clearPet() { if(currentPet != null) { petList.computeIfAbsent(currentPet.petType + ";" + currentPet.rarity.petId, k->new HashSet<>()).add(currentPet); @@ -131,7 +134,7 @@ public class PetInfoOverlay extends TextOverlay { Set<Pet> itemMatches = new HashSet<>(); for(Pet pet : pets) { if((searchItem == null && pet.petItem == null) || - (searchItem.equals(pet.petItem))) { + (searchItem != null && searchItem.equals(pet.petItem))) { itemMatches.add(pet); } } @@ -528,11 +531,17 @@ public class PetInfoOverlay extends TextOverlay { } xpGainHourLast = xpGainHour; - if(totalGain > 0) { + if(xpAddTimer > 0 || totalGain > 0) { + if(totalGain > 0) { + xpAddTimer = 10; + } else { + xpAddTimer--; + } + currentPet.petLevel.totalXp += totalGain; xpGainQueue.add(0, totalGain); - while(xpGainQueue.size() > 20) { + while(xpGainQueue.size() > 30) { xpGainQueue.removeLast(); } @@ -556,7 +565,7 @@ public class PetInfoOverlay extends TextOverlay { if(s.contains(".")) { return NumberFormat.getNumberInstance().format((int)f) + '.' + s.split("\\.")[1]; } else if(s.contains(",")) { - return NumberFormat.getNumberInstance().format((int)f) + ',' + s.split("\\.")[1]; + return NumberFormat.getNumberInstance().format((int)f) + ',' + s.split(",")[1]; } else { return s; } @@ -611,6 +620,8 @@ public class PetInfoOverlay extends TextOverlay { } } } + + private static final Pattern AUTOPET_EQUIP = Pattern.compile("\u00a7cAutopet \u00a7eequipped your \u00a77\\[Lvl (\\d+)] \u00a7(.{2,})\u00a7e! \u00a7a\u00a7lVIEW RULE\u00a7r"); @SubscribeEvent(priority = EventPriority.HIGHEST) public void onChatReceived(ClientChatReceivedEvent event) { @@ -618,7 +629,45 @@ public class PetInfoOverlay extends TextOverlay { if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && (config.petOverlay.enablePetInfo || config.treecap.enableMonkeyCheck || config.notifications.showWrongPetMsg)) { if(event.type == 0) { String chatMessage = Utils.cleanColour(event.message.getUnformattedText()); - if(chatMessage.toLowerCase().startsWith("you summoned your")) { + + if(event.message.getFormattedText().contains("Autopet")) System.out.println(event.message.getFormattedText()); + Matcher autopetMatcher = AUTOPET_EQUIP.matcher(event.message.getFormattedText()); + if(autopetMatcher.matches()) { + try { + lastLevelHovered = Integer.parseInt(autopetMatcher.group(1)); + } catch(NumberFormatException ignored) {} + + String petStringMatch = autopetMatcher.group(2); + char colChar = petStringMatch.charAt(0); + EnumChatFormatting col = EnumChatFormatting.RESET; + for(EnumChatFormatting formatting : EnumChatFormatting.values()) { + if(formatting.toString().equals("\u00a7"+colChar)) { + col = formatting; + break; + } + + } + Rarity rarity = Rarity.COMMON; + if(col != EnumChatFormatting.RESET) { + rarity = Rarity.getRarityFromColor(col); + } + + String pet = Utils.cleanColour(petStringMatch.substring(1)).trim().toUpperCase(); + if(petList.containsKey(pet + ";" + rarity.petId)) { + Set<Pet> pets = petList.get(pet + ";" + rarity.petId); + + if(pets.size() == 1) { + currentPet = pets.iterator().next(); + } else { + currentPet = getClosestPet(pet, rarity.petId, lastItemHovered, lastLevelHovered); + } + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"[NEU] Can't find pet \u00a7" + petStringMatch + + " are you sure API key is correct? Try doing /api new and rejoining hypixel.")); + } + + + } else if(chatMessage.toLowerCase().startsWith("you summoned your")) { clearPet(); String pet = chatMessage.trim().toUpperCase().replace("YOU SUMMONED YOUR ", "").replace("!", "").replace(" ", "_"); @@ -633,6 +682,9 @@ public class PetInfoOverlay extends TextOverlay { } else { currentPet = getClosestPet(pet, rarity.petId, lastItemHovered, lastLevelHovered); } + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"[NEU] Can't find pet " + pet + ";" + rarity.petId + + " are you sure API key is correct? Try doing /api new and rejoining hypixel.")); } } else if(chatMessage.toLowerCase().startsWith("you despawned your")) { clearPet(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index e6beb660..f4228ce0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -6,8 +6,10 @@ import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -24,20 +26,27 @@ public class GuiEnchantColour extends GuiScreen { private int guiLeft; private int guiTop; - private final int xSize = 176; + private final int xSize = 217; private int ySize = 0; private List<String> getEnchantColours() { return NotEnoughUpdates.INSTANCE.config.hidden.enchantColours; } - public static final Splitter splitter = Splitter.on(":").limit(4); + public static final Splitter splitter = Splitter.on(":").limit(5); private HashMap<Integer, String> comparators = new HashMap<>(); + private HashMap<Integer, String> modifiers = new HashMap<>(); private List<GuiElementTextField[]> guiElementTextFields = new ArrayList<>(); private LerpingInteger scroll = new LerpingInteger(0, 100); + public static int BOLD_MODIFIER = 0b1; + public static int ITALIC_MODIFIER = 0b10; + public static int OBFUSCATED_MODIFIER = 0b100; + public static int UNDERLINE_MODIFIER = 0b1000; + public static int STRIKETHROUGH_MODIFIER = 0b10000; + @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { drawDefaultBackground(); @@ -66,10 +75,10 @@ public class GuiEnchantColour extends GuiScreen { Utils.drawTexturedRect(guiLeft, guiTop+ySize-32, xSize, 32, 0, 1, 46/78f, 1, GL11.GL_NEAREST); fontRendererObj.drawString("Ench Name", guiLeft+10, guiTop+7, 4210752); - fontRendererObj.drawString("CMP", guiLeft+71, guiTop+7, 4210752); - fontRendererObj.drawString("LVL", guiLeft+96, guiTop+7, 4210752); - fontRendererObj.drawString("COL", guiLeft+121, guiTop+7, 4210752); - fontRendererObj.drawString("DEL", guiLeft+146, guiTop+7, 4210752); + fontRendererObj.drawString("CMP", guiLeft+86, guiTop+7, 4210752); + fontRendererObj.drawString("LVL", guiLeft+111, guiTop+7, 4210752); + fontRendererObj.drawString("COL", guiLeft+136, guiTop+7, 4210752); + fontRendererObj.drawString("DEL", guiLeft+161, guiTop+7, 4210752); Utils.drawStringCentered("Add Ench Colour", fontRendererObj, guiLeft+xSize/2, guiTop+ySize-20, false, 4210752); @@ -84,18 +93,20 @@ public class GuiEnchantColour extends GuiScreen { String comparator = getColourOpIndex(colourOps, 1); String comparison = getColourOpIndex(colourOps, 2); String colourCode = getColourOpIndex(colourOps, 3); + String modifier = getColourOpIndex(colourOps, 4); + modifiers.put(yIndex, modifier); if(colourCode.length() > 1) colourCode = String.valueOf(colourCode.toLowerCase().charAt(0)); if(comparator.length() > 1) comparator = String.valueOf(comparator.toLowerCase().charAt(0)); - Utils.drawStringCentered(comparator, fontRendererObj, guiLeft+81, guiTop+33+25*yIndex, false, 4210752); + Utils.drawStringCentered(comparator, fontRendererObj, guiLeft+96, guiTop+33+25*yIndex, false, 4210752); if(guiElementTextFields.size() <= yIndex) { guiElementTextFields.add(new GuiElementTextField[3]); } if(guiElementTextFields.get(yIndex)[0] == null) { guiElementTextFields.get(yIndex)[0] = new GuiElementTextField(enchantName, GuiElementTextField.SCALE_TEXT); - guiElementTextFields.get(yIndex)[0].setSize(56, 20); + guiElementTextFields.get(yIndex)[0].setSize(75, 20); } if(guiElementTextFields.get(yIndex)[1] == null) { guiElementTextFields.get(yIndex)[1] = new GuiElementTextField(comparison, @@ -111,9 +122,23 @@ public class GuiEnchantColour extends GuiScreen { comparators.put(yIndex, comparator); guiElementTextFields.get(yIndex)[2].setText(colourCode); - guiElementTextFields.get(yIndex)[0].render(guiLeft+10, guiTop+23+25*yIndex); - guiElementTextFields.get(yIndex)[1].render(guiLeft+96, guiTop+23+25*yIndex); - guiElementTextFields.get(yIndex)[2].render(guiLeft+121, guiTop+23+25*yIndex); + guiElementTextFields.get(yIndex)[0].render(guiLeft+7, guiTop+23+25*yIndex); + guiElementTextFields.get(yIndex)[1].render(guiLeft+110, guiTop+23+25*yIndex); + guiElementTextFields.get(yIndex)[2].render(guiLeft+135, guiTop+23+25*yIndex); + + int modifierI = getIntModifier(modifier); + if((modifierI & GuiEnchantColour.BOLD_MODIFIER) != 0) { + Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7l\u2713", guiLeft+181, guiTop+23+25*yIndex-2, 0xff202020, true); + } + if((modifierI & GuiEnchantColour.ITALIC_MODIFIER) != 0) { + Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7l\u2713", guiLeft+181, guiTop+23+25*yIndex+10, 0xff202020, true); + } + if((modifierI & GuiEnchantColour.UNDERLINE_MODIFIER) != 0) { + Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7l\u2713", guiLeft+196, guiTop+23+25*yIndex-2, 0xff202020, true); + } + if((modifierI & GuiEnchantColour.STRIKETHROUGH_MODIFIER) != 0) { + Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7l\u2713", guiLeft+196, guiTop+23+25*yIndex+10, 0xff202020, true); + } yIndex++; } @@ -139,9 +164,8 @@ public class GuiEnchantColour extends GuiScreen { } else if(yIndex+addOffset > NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.size()) { addOffset = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.size()-yIndex; } - System.out.println(addOffset); NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex+addOffset, - getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex))); + getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex), modifiers.get(yIndex))); if(addOffset != 0) { GuiElementTextField[] guiElementTextFieldArray = guiElementTextFields.remove(yIndex); guiElementTextFields.add(yIndex+addOffset, guiElementTextFieldArray); @@ -152,7 +176,7 @@ public class GuiEnchantColour extends GuiScreen { } } - public String getEnchantOpString(GuiElementTextField[] tfs, String comparator) { + public String getEnchantOpString(GuiElementTextField[] tfs, String comparator, String modifiers) { StringBuilder enchantOp = new StringBuilder(); enchantOp.append(tfs[0].getText()); enchantOp.append(":"); @@ -161,6 +185,8 @@ public class GuiEnchantColour extends GuiScreen { enchantOp.append(tfs[1].getText()); enchantOp.append(":"); enchantOp.append(tfs[2].getText()); + enchantOp.append(":"); + enchantOp.append(modifiers); return enchantOp.toString(); } @@ -179,14 +205,22 @@ public class GuiEnchantColour extends GuiScreen { } } + public static int getIntModifier(String modifier) { + try { + return Integer.parseInt(modifier); + } catch(NumberFormatException e) { + return 0; + } + } + @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); for(int yIndex=0; yIndex<guiElementTextFields.size(); yIndex++) { for(int i=0; i<3; i++) { - int x = guiLeft+10; - if(i == 1) x+=86; - else if(i == 2) x+=111; + int x = guiLeft+7; + if(i == 1) x+=103; + else if(i == 2) x+=128; if(mouseX > x && mouseX < x+guiElementTextFields.get(yIndex)[i].getWidth()) { if(mouseY > guiTop+23+25*yIndex && mouseY < guiTop+23+25*yIndex+20) { @@ -194,16 +228,51 @@ public class GuiEnchantColour extends GuiScreen { if(mouseButton == 1) { NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex); NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex, - getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex))); + getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex), modifiers.get(yIndex))); } continue; } } guiElementTextFields.get(yIndex)[i].otherComponentClick(); } - comparators.computeIfAbsent(yIndex, k->">"); + comparators.putIfAbsent(yIndex, ">"); + modifiers.putIfAbsent(yIndex, "0"); + if(mouseX >= guiLeft+180 && mouseX <= guiLeft+210 && + mouseY >= guiTop+23+25*yIndex && mouseY <= guiTop+23+25*yIndex+20) { + int modifierI = getIntModifier(modifiers.get(yIndex)); + int selectedModifier = -1; + + if(mouseX < guiLeft+195) { + if(mouseY < guiTop+23+25*yIndex+10) { + selectedModifier = BOLD_MODIFIER; + } else { + selectedModifier = ITALIC_MODIFIER; + } + } else { + if(mouseY < guiTop+23+25*yIndex+10) { + selectedModifier = UNDERLINE_MODIFIER; + } else { + selectedModifier = STRIKETHROUGH_MODIFIER; + } + } + + if(selectedModifier != -1) { + int modifierMasked = (modifierI & selectedModifier); + int modifierMaskedInverted = selectedModifier - modifierMasked; + + int modifierInverted = (-1) - selectedModifier; + + int finalModifier = (modifierI & modifierInverted) | modifierMaskedInverted; + + modifiers.put(yIndex, ""+finalModifier); + + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex); + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex, + getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex), modifiers.get(yIndex))); + } + } if(mouseY > guiTop+23+25*yIndex && mouseY < guiTop+23+25*yIndex+20) { - if(mouseX > guiLeft+71 && mouseX < guiLeft+71+20) { + if(mouseX > guiLeft+86 && mouseX < guiLeft+86+20) { switch (comparators.get(yIndex)) { case ">": comparators.put(yIndex, "="); break; @@ -214,17 +283,18 @@ public class GuiEnchantColour extends GuiScreen { } NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex); NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex, - getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex))); - } else if(mouseX > guiLeft+146 && mouseX < guiLeft+146+20) { + getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex), modifiers.get(yIndex))); + } else if(mouseX > guiLeft+160 && mouseX < guiLeft+160+20) { NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex); guiElementTextFields.remove(yIndex); comparators.remove(yIndex); + modifiers.remove(yIndex); } } } - if(mouseX >= guiLeft+42 && mouseX <= guiLeft+42+88) { + if(mouseX >= guiLeft+57 && mouseX <= guiLeft+xSize-57) { if(mouseY >= guiTop+ySize-30 && mouseY <= guiTop+ySize-10) { - NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add("[a-zA-Z\\- ]+:>:5:9"); + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add("[a-zA-Z\\- ]+:>:5:9:0"); } } } @@ -242,6 +312,8 @@ public class GuiEnchantColour extends GuiScreen { return "5"; case 3: return "9"; + case 4: + return "0"; } } return null; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java index 39e42152..1119c571 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; import io.github.moulberry.notenoughupdates.miscfeatures.DamageCommas; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.Entity; @@ -7,11 +8,14 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.IChatComponent; 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.CallbackInfoReturnable; @Mixin(RendererLivingEntity.class) -public class MixinRendererLivingEntity { +public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> { @Redirect(method = "renderName", at=@At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;getDisplayName()Lnet/minecraft/util/IChatComponent;")) @@ -23,4 +27,12 @@ public class MixinRendererLivingEntity { } } + @Inject(method="getColorMultiplier", at=@At("HEAD"), cancellable = true) + public void getColorMultiplier(T entitylivingbaseIn, float lightBrightness, + float partialTickTime, CallbackInfoReturnable<Integer> cir) { + if(CustomItemEffects.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) { + cir.setReturnValue(0x80ff9500); + } + } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 9da74db9..60c28a37 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -242,6 +242,13 @@ public class NEUConfig extends Config { @Expose @Category( + name = "Bonemerang Overlay", + desc = "Bonemerang Overlay" + ) + public BonemerangOverlay bonemerangOverlay = new BonemerangOverlay(); + + @Expose + @Category( name = "Accessory Bag Overlay", desc = "Accessory Bag Overlay" ) @@ -315,7 +322,7 @@ public class NEUConfig extends Config { @ConfigEditorDropdown( values = {"Off", "Commas", "Shortened"} ) - public int damageCommas = 1; + public int damageIndicatorStyle = 1; } public static class Notifications { @@ -1366,6 +1373,24 @@ public class NEUConfig extends Config { public String dungBatColour = "0:255:12:255:0"; } + public static class BonemerangOverlay { + @Expose + @ConfigOption( + name = "Highlight Targeted Entities", + desc = "Highlight entities that will be hit by your bonemerang" + ) + @ConfigEditorBoolean + public boolean highlightTargeted = true; + + @Expose + @ConfigOption( + name = "Break Warning", + desc = "Show a warning below your crosshair if the bonemerang will break on a block" + ) + @ConfigEditorBoolean + public boolean showBreak = true; + } + public static class AccessoryBag { @Expose @ConfigOption( @@ -1508,13 +1533,13 @@ public class NEUConfig extends Config { @Expose public ArrayList<String> eventFavourites = new ArrayList<>(); @Expose public ArrayList<String> quickCommands = createDefaultQuickCommands(); @Expose public ArrayList<String> enchantColours = Lists.newArrayList( - "[a-zA-Z\\- ]+:\u003e:9:6", - "[a-zA-Z\\- ]+:\u003e:6:c", - "[a-zA-Z\\- ]+:\u003e:5:5", - "Experience:\u003e:3:5", - "Life Steal:\u003e:3:5", - "Scavenger:\u003e:3:5", - "Looting:\u003e:3:5"); + "[a-zA-Z\\- ]+:\u003e:9:6:0", + "[a-zA-Z\\- ]+:\u003e:6:c:0", + "[a-zA-Z\\- ]+:\u003e:5:5:0", + "Experience:\u003e:3:5:0", + "Life Steal:\u003e:3:5:0", + "Scavenger:\u003e:3:5:0", + "Looting:\u003e:3:5:0"); } public static class DungeonMap { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 83c7962e..152d201d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -71,6 +71,7 @@ public class AuctionSearchOverlay { }; public static boolean shouldReplace() { + if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return false; if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false; if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) { @@ -159,8 +160,10 @@ public class AuctionSearchOverlay { String itemName = Utils.trimIgnoreColour(stack.getDisplayName().replaceAll("\\[.+]", "")); if(itemName.contains("Enchanted Book") && str.contains(";")) { - itemName = EnumChatFormatting.BLUE+WordUtils.capitalizeFully(str.split(";")[0].replace("_", " ")); + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + itemName = lore[0].trim(); } + Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(itemName, 165), width/2-74, topY+35+num*22+1, 0xdddddd, true); @@ -422,7 +425,11 @@ public class AuctionSearchOverlay { if(mouseX >= width/2-96 && mouseX <= width/2+96 && mouseY >= topY+30+num*22 && mouseY <= topY+30+num*22+20) { searchString = Utils.cleanColour(stack.getDisplayName().replaceAll("\\[.+]", "")).trim(); if(searchString.contains("Enchanted Book") && str.contains(";")) { - searchString = WordUtils.capitalizeFully(str.split(";")[0].replace("_", " ")); + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + String[] split = Utils.cleanColour(lore[0]).trim().split(" "); + split[split.length-1] = ""; + + searchString = StringUtils.join(split, " ").trim(); } JsonObject essenceCosts = Constants.ESSENCECOSTS; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java index 98761e04..ecb4ee5b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java @@ -37,6 +37,8 @@ public class FarmingOverlay extends TextOverlay { private float xpGainHourLast = -1; private float xpGainHour = -1; + private int xpGainTimer = 0; + private String skillType = "Farming"; public FarmingOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { @@ -58,6 +60,7 @@ public class FarmingOverlay extends TextOverlay { if(!NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingOverlay) { counter = -1; overlayStrings = null; + dicerHeld = false; return; } @@ -78,6 +81,9 @@ public class FarmingOverlay extends TextOverlay { if(ea.hasKey("mined_crops", 99)) { counter = ea.getInteger("mined_crops"); counterQueue.add(0, counter); + } else if(ea.hasKey("farmed_cultivating", 99)) { + counter = ea.getInteger("farmed_cultivating"); + counterQueue.add(0, counter); } } } @@ -100,15 +106,31 @@ public class FarmingOverlay extends TextOverlay { float delta = totalXp - lastTotalXp; if(delta > 0 && delta < 1000) { + xpGainTimer = 3; + xpGainQueue.add(0, delta); - while (xpGainQueue.size() > 20) { + while(xpGainQueue.size() > 30) { + xpGainQueue.removeLast(); + } + + float totalGain = 0; + for(float f : xpGainQueue) totalGain += f; + + xpGainHour = totalGain * (60 * 60) / xpGainQueue.size(); + + isFarming = true; + } else if(xpGainTimer > 0) { + xpGainTimer--; + + xpGainQueue.add(0, 0f); + while(xpGainQueue.size() > 30) { xpGainQueue.removeLast(); } float totalGain = 0; for(float f : xpGainQueue) totalGain += f; - xpGainHour = totalGain*(60*60)/xpGainQueue.size(); + xpGainHour = totalGain * (60 * 60) / xpGainQueue.size(); isFarming = true; } else if(delta <= 0) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 930d4d39..5cb58dcd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -2,14 +2,19 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; +import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; +import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; @@ -33,6 +38,72 @@ public class MiningOverlay extends TextOverlay { public void update() { overlayStrings = null; + /*if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); + + + long currentTime = System.currentTimeMillis(); + if(currentTime - lastSkymallSync > 60*1000) { + if(CapeManager.getInstance().lastJsonSync != null) { + JsonObject obj = CapeManager.getInstance().lastJsonSync; + if(obj.has("skymall") && obj.get("skymall").isJsonPrimitive()) { + activeSkymall = obj.get("skymall").getAsString(); + } + } + } + + if(containerName.equals("Heart of the Mountain") && container.getLowerChestInventory().getSizeInventory() > 10) { + System.out.println("HOTM Container"); + ItemStack stack = container.getLowerChestInventory().getStackInSlot(10); + if(stack != null && stack.getDisplayName().equals(GREEN+"Sky Mall")) { + NotEnoughUpdates.INSTANCE.config.hidden.skymallActive = false; + + String[] lines = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + + for(String line : lines) { + if(line.equals("\u00a7aYour Current Effect")) { + System.out.println("Current effect"); + NotEnoughUpdates.INSTANCE.config.hidden.skymallActive = true; + } else if(NotEnoughUpdates.INSTANCE.config.hidden.skymallActive) { + String prevActiveSkymall = activeSkymall; + System.out.println("Setting"); + if(line.contains("Gain \u00a7a+100 \u00a76\u2E15 Mining Speed")) { + activeSkymall = "mining_speed"; + } else if(line.contains("Gain \u00a7a+50 \u00a76\u2618 Mining Fortune")) { + activeSkymall = "mining_fortune"; + } else if(line.contains("Gain \u00a7a+15% \u00a77Powder from mining")) { + activeSkymall = "powder"; + } else if(line.contains("Reduce Pickaxe Ability cooldown")) { + activeSkymall = "pickaxe_ability"; + } else if(line.contains("10x \u00a77chance to find Goblins")) { + activeSkymall = "goblin"; + } else if(line.contains("Gain \u00a7a5x \u00a79Titanium \u00a77drops")) { + activeSkymall = "titanium"; + } else { + System.out.println("Unknown"); + activeSkymall = "unknown"; + } + if(!activeSkymall.equals(prevActiveSkymall)) { + System.out.println("Maybe sending to server"); + if(currentTime - lastSkymallSync > 60*1000) { + lastSkymallSync = currentTime; + System.out.println("Sending to server"); + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getMyApiAsync("skymall?"+activeSkymall, (jsonObject) -> { + System.out.println("Success!"); + }, () -> { + System.out.println("Error!"); + }); + } + } + break; + } + } + } + } + }*/ + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) return; if(SBInfo.getInstance().getLocation() == null) return; if(!SBInfo.getInstance().getLocation().equals("mining_3")) return; 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 98078bb8..3d186de2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1357,7 +1357,7 @@ public class GuiProfileViewer extends GuiScreen { Minecraft.getMinecraft().fontRendererObj.drawString(display, -halfDisplayLen-28, 0, 0, true); ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item); - GlStateManager.scale(-3.5f, 3.5f, 1); + GlStateManager.scale(3.5f, 3.5f, 1); GlStateManager.enableDepth(); Utils.drawItemStack(stack, 0, 0); GlStateManager.scale(-1/3.5f, 1/3.5f, 1); |