Package org.spout.vanilla.component.entity.player.hud

Examples of org.spout.vanilla.component.entity.player.hud.GUIWidget


   * force an update (forced update not implemented yet)
   *
   * @return New or already attached class
   */
  public <T extends GUIWidget> T setDefault(Class<T> clazz, boolean force) {
    GUIWidget widget = null;
    try {
      widget = clazz.newInstance();
    } catch (InstantiationException ex) {
      Spout.getLogger().log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      Spout.getLogger().log(Level.SEVERE, null, ex);
    }

    if (widget instanceof QuickbarWidget) {
      // There has to be a better way to do this.
      if (quickbarWidget != null && !force) {
        return (T) quickbarWidget;
      }
      quickbarWidget = (QuickbarWidget) widget;
    } else if (widget instanceof ArmorWidget) {
      if (armorWidget != null && !force) {
        return (T) armorWidget;
      }
      armorWidget = (ArmorWidget) widget;
    } else if (widget instanceof ExpBarWidget) {
      if (expBar != null && !force) {
        return (T) expBar;
      }
      expBar = (ExpBarWidget) widget;
    } else if (widget instanceof CrosshairWidget) {
      if (crosshairWidget != null && !force) {
        return (T) crosshairWidget;
      }
      crosshairWidget = (CrosshairWidget) widget;
    } else if (widget instanceof DrowningWidget) {
      if (drowningWidget != null && !force) {
        return (T) drowningWidget;
      }
      drowningWidget = (DrowningWidget) widget;
    } else if (widget instanceof HungerWidget) {
      if (hungerWidget != null && !force) {
        return (T) hungerWidget;
      }
      hungerWidget = (HungerWidget) widget;
    } else if (widget instanceof GUIWidget) {
      // Not a CORE GUI add to other attachments and initialize
      if (!force) {
        GUIWidget wid = widgets.putIfAbsent(clazz, widget);
        if (wid != null) {
          widget = wid;
        }
      } else {
        widgets.put(clazz, widget);
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.entity.player.hud.GUIWidget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.