Class ShapeComponent


public final class ShapeComponent extends GuiComponent<ShapeComponent>
Rectangular retained surface clipped to an authored shape.

The component reuses RenderLib's retained clip compositor, so its box paint, descendants, transforms, effects, and pointer hit region follow the configured silhouette. Foreground clipping is composited at this component's extraction-order boundary, preserving HUD and GUI pixels outside the shape, including content submitted by other mods. Ordinary box borders are still authored around the rectangular box and therefore do not trace concave interior edges.

Without a configured shape this component behaves like a RectangleComponent.

  • Constructor Details

    • ShapeComponent

      public ShapeComponent()
  • Method Details

    • shape

      public ShapeComponent shape(GuiClipPath shape)
      Clips this component to an arbitrary retained clip shape.
      Parameters:
      shape - retained shape
      Returns:
      this component
    • polygon

      public ShapeComponent polygon(List<GuiClipPath.Point> points)
      Clips this component to a normalized border-box polygon.
      Parameters:
      points - ordered polygon points using normalized box coordinates
      Returns:
      this component
    • path

      public ShapeComponent path(String data)
      Clips this component to SVG-compatible path data.

      Path coordinates use design-space units relative to the component's border-box origin, matching GuiClipPath.Path.

      Parameters:
      data - SVG-compatible path data
      Returns:
      this component
    • plus

      public ShapeComponent plus(float armThickness)
      Configures a centered plus silhouette.
      Parameters:
      armThickness - normalized arm thickness in (0, 1]
      Returns:
      this component
    • elbow

      public ShapeComponent elbow(float thickness, ShapeComponent.ElbowCorner corner)
      Configures an elbow silhouette whose arms meet at the supplied corner.
      Parameters:
      thickness - normalized arm thickness in (0, 1]
      corner - corner occupied by both arms
      Returns:
      this component
    • renderSelf

      protected void renderSelf(com.render.api.gui.GuiRenderContext context)
      Overrides:
      renderSelf in class GuiComponent<ShapeComponent>