List of usage examples for net.minecraftforge.fml.client.config HoverChecker HoverChecker
public HoverChecker(Button button, int threshold)
From source file:org.blockartistry.DynSurround.client.gui.SoundConfigEntry.java
License:MIT License
public SoundConfigEntry(@Nonnull final GuiConfig owningScreen, @Nonnull final GuiConfigEntries owningEntryList, @Nonnull final IConfigElement configElement) { super(owningScreen, owningEntryList, new ConfigElementSliderAdapter(configElement)); final String soundName = configElement.getName(); // Parse out our parameter string String parms = (String) configElement.get(); final boolean culled = parms.contains(GuiConstants.TOKEN_CULL); final boolean blocked = parms.contains(GuiConstants.TOKEN_BLOCK); this.cull = new CheckBoxButton(ID_CULLED, GuiConstants.TEXT_CULL, culled, false); this.block = new CheckBoxButton(ID_BLOCKED, GuiConstants.TEXT_BLOCK, blocked, false); this.play = new PlaySoundButton(ID_PLAY, soundName); this.cullHover = new HoverChecker(this.cull, 800); this.blockHover = new HoverChecker(this.block, 800); this.playHover = new HoverChecker(this.play, 800); this.sliderHover = new HoverChecker(null, 800); // Replace the slider tooltip with our own version final List<String> text = Lists.newArrayList(); final ResourceLocation soundResource = new ResourceLocation(soundName); text.add(TextFormatting.GREEN + ForgeUtils.getModName(soundResource)); text.add(TextFormatting.GOLD + soundName); final SoundMetadata data = SoundRegistry.getSoundMetadata(soundResource); if (data != null) { boolean spaceAdded = false; final String title = data.getTitle(); if (!StringUtils.isEmpty(title)) { spaceAdded = true;/*from w w w. jav a2 s .c o m*/ text.add(""); text.add(TextFormatting.YELLOW + title); } final List<String> credits = data.getCredits(); if (credits != null && credits.size() > 0) { if (!spaceAdded) text.add(""); for (final String s : credits) text.add(s); } } this.toolTip = ImmutableList.copyOf(text); this.realConfig = configElement; }
From source file:org.blockartistry.lib.gui.GuiTooltip.java
License:MIT License
public GuiTooltip(@Nonnull final ITooltipRenderer renderer, @Nonnull GuiButton button, @Nonnull final String tipText, final int width) { final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; this.renderer = renderer; this.checker = new HoverChecker(button, 800); this.tooltip = generateTooltip(font, tipText, width); }