11package codes .biscuit .skyblockaddons .listeners ;
22
33import codes .biscuit .skyblockaddons .SkyblockAddons ;
4- import codes .biscuit .skyblockaddons .core .Attribute ;
5- import codes .biscuit .skyblockaddons .core .Feature ;
6- import codes .biscuit .skyblockaddons .core .Location ;
7- import codes .biscuit .skyblockaddons .core .Message ;
4+ import codes .biscuit .skyblockaddons .core .*;
5+ import codes .biscuit .skyblockaddons .features .BaitManager ;
86import codes .biscuit .skyblockaddons .features .EnchantedItemBlacklist ;
97import codes .biscuit .skyblockaddons .features .EndstoneProtectorManager ;
108import codes .biscuit .skyblockaddons .features .backpacks .Backpack ;
119import codes .biscuit .skyblockaddons .features .backpacks .BackpackManager ;
12- import codes .biscuit .skyblockaddons .features .BaitManager ;
1310import codes .biscuit .skyblockaddons .features .cooldowns .CooldownManager ;
1411import codes .biscuit .skyblockaddons .features .powerorbs .PowerOrbManager ;
1512import codes .biscuit .skyblockaddons .features .tabtimers .TabEffectManager ;
@@ -692,28 +689,6 @@ public void onItemTooltip(ItemTooltipEvent e) {
692689 }
693690 }
694691
695- if (main .getConfigValues ().isEnabled (Feature .SHOW_ITEM_ANVIL_USES )) {
696- // Anvil Uses ~ original done by Dahn#6036
697- int anvilUses = main .getUtils ().getNBTInteger (hoveredItem , "ExtraAttributes" , "anvil_uses" );
698- if (anvilUses != -1 ) {
699- int insertAt = e .toolTip .size ();
700- insertAt --; // 1 line for the rarity
701- if (Minecraft .getMinecraft ().gameSettings .advancedItemTooltips ) {
702- insertAt -= 2 ; // 1 line for the item name, and 1 line for the nbt
703- if (e .itemStack .isItemDamaged ()) {
704- insertAt --; // 1 line for damage
705- }
706- }
707- int hotPotatoCount = main .getUtils ().getNBTInteger (hoveredItem , "ExtraAttributes" , "hot_potato_count" );
708- if (hotPotatoCount != -1 ) {
709- anvilUses -= hotPotatoCount ;
710- }
711- if (anvilUses > 0 ) {
712- e .toolTip .add (insertAt , Message .MESSAGE_ANVIL_USES .getMessage (String .valueOf (anvilUses )));
713- }
714- }
715- }
716-
717692 if (main .getConfigValues ().isEnabled (Feature .REPLACE_ROMAN_NUMERALS_WITH_NUMBERS )) {
718693 for (int i = 0 ; i < e .toolTip .size (); i ++) {
719694 e .toolTip .set (i , RomanNumeralParser .replaceNumeralsWithIntegers (e .toolTip .get (i )));
@@ -762,12 +737,26 @@ public void onItemTooltip(ItemTooltipEvent e) {
762737 }
763738 }
764739
765- // Append Skyblock Item ID to end of tooltip if in developer mode
766- if (main .isDevMode () && e .showAdvancedItemTooltips ) {
767- String itemId = ItemUtils .getSkyBlockItemID (e .itemStack );
740+ int insertAt = e .toolTip .size ();
741+ insertAt --; // 1 line for the rarity
742+ if (Minecraft .getMinecraft ().gameSettings .advancedItemTooltips ) {
743+ insertAt -= 2 ; // 1 line for the item name, and 1 line for the nbt
744+ if (e .itemStack .isItemDamaged ()) {
745+ insertAt --; // 1 line for damage
746+ }
747+ }
768748
769- if (itemId != null ) {
770- e .toolTip .add (EnumChatFormatting .DARK_GRAY + "Skyblock ID: " + itemId );
749+ if (main .getConfigValues ().isEnabled (Feature .SHOW_ITEM_ANVIL_USES )) {
750+ // Anvil Uses ~ original done by Dahn#6036
751+ int anvilUses = main .getUtils ().getNBTInteger (hoveredItem , "ExtraAttributes" , "anvil_uses" );
752+ if (anvilUses != -1 ) {
753+ int hotPotatoCount = main .getUtils ().getNBTInteger (hoveredItem , "ExtraAttributes" , "hot_potato_count" );
754+ if (hotPotatoCount != -1 ) {
755+ anvilUses -= hotPotatoCount ;
756+ }
757+ if (anvilUses > 0 ) {
758+ e .toolTip .add (insertAt ++, Message .MESSAGE_ANVIL_USES .getMessage (String .valueOf (anvilUses )));
759+ }
771760 }
772761 }
773762
@@ -778,12 +767,41 @@ public void onItemTooltip(ItemTooltipEvent e) {
778767
779768 if (extraAttributesTag != null ) {
780769 if (extraAttributesTag .hasKey ("bossId" ) && extraAttributesTag .hasKey ("spawnedFor" )) {
781- e .toolTip .add ("§c§lBROKEN FRAGMENT§r" );
770+ e .toolTip .add (insertAt ++, "§c§lBROKEN FRAGMENT§r" );
782771 }
783772 }
784773 }
785774 }
786775 }
776+
777+ if (main .getConfigValues ().isEnabled (Feature .SHOW_BASE_STAT_BOOST_PERCENTAGE ) && hoveredItem .hasTagCompound ()) {
778+ NBTTagCompound extraAttributes = ItemUtils .getExtraAttributes (hoveredItem );
779+ if (extraAttributes != null ) {
780+ int baseStatBoost = ItemUtils .getBaseStatBoostPercentage (extraAttributes );
781+ if (baseStatBoost != -1 ) {
782+
783+ ColorCode colorCode = main .getConfigValues ().getRestrictedColor (Feature .SHOW_BASE_STAT_BOOST_PERCENTAGE );
784+ if (main .getConfigValues ().isEnabled (Feature .SHOW_BASE_STAT_BOOST_PERCENTAGE_COLOUR_BY_RARITY )) {
785+
786+ int rarityIndex = baseStatBoost /10 ;
787+ if (rarityIndex < 0 ) rarityIndex = 0 ;
788+ if (rarityIndex >= ItemRarity .values ().length ) rarityIndex = ItemRarity .values ().length - 1 ;
789+
790+ colorCode = ItemRarity .values ()[rarityIndex ].getColorCode ();
791+ }
792+ e .toolTip .add (insertAt , "§7Base Stat Boost: " + colorCode + "+" + baseStatBoost + "%" );
793+ }
794+ }
795+ }
796+
797+ // Append Skyblock Item ID to end of tooltip if in developer mode
798+ if (main .isDevMode () && e .showAdvancedItemTooltips ) {
799+ String itemId = ItemUtils .getSkyBlockItemID (e .itemStack );
800+
801+ if (itemId != null ) {
802+ e .toolTip .add (insertAt ++, EnumChatFormatting .DARK_GRAY + "Skyblock ID: " + itemId );
803+ }
804+ }
787805 }
788806 }
789807
0 commit comments