File tree Expand file tree Collapse file tree
src/main/java/com/circulation/random_complement Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717@ Mod .EventBusSubscriber (modid = RandomComplement .MOD_ID )
1818public class RCConfig {
1919
20+ @ Config .Comment ({"Enable additional item information prompts" })
21+ @ Config .Name ("ExTooltip" )
22+ public static boolean ExTooltip = true ;
23+
2024 @ Config .Name ("AE2" )
2125 public static final ae2 AE2 = new ae2 ();
2226
Original file line number Diff line number Diff line change 33import org .jetbrains .annotations .NotNull ;
44
55import java .util .List ;
6+ import java .util .function .Supplier ;
67
78@ FunctionalInterface
8- public interface ItemTooltipAdd {
9+ public interface ItemTooltipAdd extends Supplier < List < String >> {
910
1011 @ NotNull
1112 List <String > get ();
Original file line number Diff line number Diff line change 1414import net .minecraftforge .fml .relauncher .Side ;
1515import net .minecraftforge .fml .relauncher .SideOnly ;
1616
17+ import java .util .List ;
18+ import java .util .function .Supplier ;
19+
1720@ SideOnly (Side .CLIENT )
1821public class RegItemTooltip {
1922
@@ -23,7 +26,7 @@ public static void regAll() {
2326
2427 @ Optional .Method (modid = "ae2fc" )
2528 private static void regAE2FCTooltips () {
26- ItemTooltipAdd t = () -> {
29+ Supplier < List < String >> t = () -> {
2730 if (((AEBaseGui ) Minecraft .getMinecraft ().currentScreen ).getSlotUnderMouse () instanceof SlotFake ) {
2831 return ObjectLists .singleton (I18n .format ("key.ae2fc.pattern.tooltip.0" , GameSettings .getKeyDisplayString (-98 )));
2932 }
Original file line number Diff line number Diff line change 11package com .circulation .random_complement .client .handler ;
22
3- import com .circulation .random_complement .client . ItemTooltipAdd ;
3+ import com .circulation .random_complement .RCConfig ;
44import it .unimi .dsi .fastutil .objects .ObjectArrayList ;
55import it .unimi .dsi .fastutil .objects .Reference2ObjectLinkedOpenHashMap ;
66import net .minecraft .client .Minecraft ;
1313
1414import java .util .List ;
1515import java .util .Map ;
16+ import java .util .function .Supplier ;
1617
1718@ SideOnly (Side .CLIENT )
1819public class ItemTooltipHandler {
1920
2021 public static final ItemTooltipHandler INSTANCE = new ItemTooltipHandler ();
21- private static final Map <Class <? extends GuiScreen >, List <ItemTooltipAdd >> map = new Reference2ObjectLinkedOpenHashMap <>();
22+ private static final Map <Class <? extends GuiScreen >, List <Supplier < List < String >> >> map = new Reference2ObjectLinkedOpenHashMap <>();
2223
23- public static void regItemTooltip (Class <? extends GuiScreen > aClass , ItemTooltipAdd tooltip ) {
24+ public static void regItemTooltip (Class <? extends GuiScreen > aClass , Supplier < List < String >> tooltip ) {
2425 synchronized (map ) {
2526 map .computeIfAbsent (aClass , c -> new ObjectArrayList <>())
2627 .add (tooltip );
@@ -32,6 +33,7 @@ private ItemTooltipHandler() {
3233
3334 @ SubscribeEvent
3435 public void onItemTooltip (ItemTooltipEvent event ) {
36+ if (!RCConfig .ExTooltip ) return ;
3537 final var gui = Minecraft .getMinecraft ().currentScreen ;
3638 if (gui == null ) return ;
3739 if (GuiScreen .isAltKeyDown ()) {
You can’t perform that action at this time.
0 commit comments