Example usage for net.minecraftforge.fml.client.config IConfigElement getName

List of usage examples for net.minecraftforge.fml.client.config IConfigElement getName

Introduction

In this page you can find the example usage for net.minecraftforge.fml.client.config IConfigElement getName.

Prototype

String getName();

Source Link

Document

[Property, Category] Gets the name of this object.

Usage

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 ww .j ava  2 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;

}