public GenericLivingEntity() { super(); Color color = new Color(0, 0, 0, 0.75f); this.addChildren( _bar = (Container) new GenericContainer( // Used for the bar, this.children with an index 1+ are // targets new GenericGradient() .setTopColor(color) .setBottomColor(color) .setPriority(RenderPriority.Highest), new GenericContainer( _health = (Gradient) new GenericGradient(), _armor = (Gradient) new GenericGradient()) .setMargin(1) .setPriority(RenderPriority.High), new GenericContainer( _face = (GenericFace) new GenericFace() .setVisible(MMOCore.config_show_player_faces) .setMargin(3, 0, 3, 3), _label = (Label) new GenericLabel() .setResize(true) .setFixed(true) .setMargin(3, 3, 1, 3)) .setLayout(ContainerType.HORIZONTAL)) .setLayout(ContainerType.OVERLAY) .setMaxHeight(def_height) .setMargin(0, 0, 1, 0)) .setAlign(WidgetAnchor.TOP_LEFT) .setMinWidth(def_width) // .setMaxWidth(def_width * 2) .setMaxHeight(def_height + 1); color = new Color(1f, 0, 0, 0.75f); _health.setTopColor(color).setBottomColor(color); color = new Color(0.75f, 0.75f, 0.75f, 0.75f); _armor.setTopColor(color).setBottomColor(color); }
/** * Set the armor colour to use. * * @param color the solid colour for the health bar * @return this */ public GenericLivingEntity setArmorColor(Color color) { _armor.setTopColor(color).setBottomColor(color); return this; }
/** * Set the health colour to use. * * @param color the solid colour for the health bar * @return this */ public GenericLivingEntity setHealthColor(Color color) { _health.setTopColor(color).setBottomColor(color); return this; }