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

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

Introduction

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

Prototype

Object get();

Source Link

Document

[Property] Gets this property value.

Usage

From source file:com.kegare.bedrocklayer.client.config.CycleIntegerEntry.java

License:Minecraft Mod Public

public CycleIntegerEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList,
        IConfigElement configElement) {
    super(owningScreen, owningEntryList, configElement);
    this.beforeValue = NumberUtils.toInt(configElement.get().toString());
    this.defaultValue = NumberUtils.toInt(configElement.getDefault().toString());
    this.currentValue = beforeValue;
    this.btnValue.enabled = enabled();

    updateValueButtonText();/*from ww w. j  ava  2  s  . c om*/
}

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;/* w  ww.  jav  a  2s.co  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;

}