Package net.minecraftforge.client.gui
Class OverlayRegistry
java.lang.Object
net.minecraftforge.client.gui.OverlayRegistry
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final Map<IIngameOverlay,
OverlayRegistry.OverlayEntry> private static final List<OverlayRegistry.OverlayEntry>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
enableOverlay
(IIngameOverlay overlay, boolean enable) Enables or disables an overlay.static OverlayRegistry.OverlayEntry
getEntry
(IIngameOverlay overlay) Returns the information on a registered overlay.static List<OverlayRegistry.OverlayEntry>
private static IIngameOverlay
registerOverlay
(int sort, IIngameOverlay other, String displayName, IIngameOverlay overlay) static IIngameOverlay
registerOverlayAbove
(IIngameOverlay other, String displayName, IIngameOverlay overlay) Adds a new overlay entry to the registry, placed after theother
parameter in the list.static IIngameOverlay
registerOverlayBelow
(IIngameOverlay other, String displayName, IIngameOverlay overlay) Adds a new overlay entry to the registry, placed before theother
parameter in the list.static IIngameOverlay
registerOverlayBottom
(String displayName, IIngameOverlay overlay) Adds a new overlay entry to the registry, placed at the beginning of the list.static IIngameOverlay
registerOverlayTop
(String displayName, IIngameOverlay overlay) Adds a new overlay entry to the registry, placed at the end of the list.
-
Field Details
-
overlays
-
overlaysOrdered
-
-
Constructor Details
-
OverlayRegistry
public OverlayRegistry()
-
-
Method Details
-
registerOverlayBottom
public static IIngameOverlay registerOverlayBottom(@Nonnull String displayName, @Nonnull IIngameOverlay overlay) Adds a new overlay entry to the registry, placed at the beginning of the list. Call fromFMLClientSetupEvent
. No need for enqueueWork.- Parameters:
displayName
- A string for debug purposes, used primarily in exception traces coming from the overlays.overlay
- An instance, lambda or method reference for the logic used in rendering the overlay.- Returns:
- The same object passed into the
overlay
parameter.
-
registerOverlayBelow
public static IIngameOverlay registerOverlayBelow(@Nonnull IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) Adds a new overlay entry to the registry, placed before theother
parameter in the list. Call fromFMLClientSetupEvent
. No need for enqueueWork.- Parameters:
other
- The overlay to insert before. The overlay must be registered.displayName
- A string for debug purposes, used primarily in exception traces coming from the overlays.overlay
- An instance, lambda or method reference for the logic used in rendering the overlay.- Returns:
- The same object passed into the
overlay
parameter.
-
registerOverlayAbove
public static IIngameOverlay registerOverlayAbove(@Nonnull IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) Adds a new overlay entry to the registry, placed after theother
parameter in the list. Call fromFMLClientSetupEvent
. No need for enqueueWork.- Parameters:
other
- The overlay to insert after. The overlay must be registered.displayName
- A string for debug purposes, used primarily in exception traces coming from the overlays.overlay
- An instance, lambda or method reference for the logic used in rendering the overlay.- Returns:
- The same object passed into the
overlay
parameter.
-
registerOverlayTop
public static IIngameOverlay registerOverlayTop(@Nonnull String displayName, @Nonnull IIngameOverlay overlay) Adds a new overlay entry to the registry, placed at the end of the list. Call fromFMLClientSetupEvent
. No need for enqueueWork.- Parameters:
displayName
- A string for debug purposes, used primarily in exception traces coming from the overlays.overlay
- An instance, lambda or method reference for the logic used in rendering the overlay.- Returns:
- The same object passed into the
overlay
parameter.
-
registerOverlay
private static IIngameOverlay registerOverlay(int sort, @Nullable IIngameOverlay other, @Nonnull String displayName, @Nonnull IIngameOverlay overlay) -
enableOverlay
Enables or disables an overlay. This is preferred over removing overlays.- Parameters:
overlay
- The overlay object to enable or disableenable
- The new state
-
getEntry
Returns the information on a registered overlay.- Parameters:
overlay
- The overlay to obtain the information for.- Returns:
- The registration entry for this overlay.
-
orderedEntries
- Returns:
- Returns an unmodifiable view of the ordered list of entries.
-