Package journeymap.api.v2.client.display
Class Displayable
java.lang.Object
journeymap.api.v2.client.display.Displayable
- All Implemented Interfaces:
Comparable<Displayable>
- Direct Known Subclasses:
Overlay
@ParametersAreNonnullByDefault
public abstract class Displayable
extends Object
implements Comparable<Displayable>
Base class for Overlays and Waypoints.
Mods should not extend this class directly. Use one of the provided implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DisplayTypeprotected final Stringprotected final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDisplayable(String modId) Constructor with explicit display id. -
Method Summary
Modifier and TypeMethodDescriptionstatic floatclampOpacity(float opacity) Clamps an rgb int value to the allowable range of 0F-1F.static intclampRGB(int rgb) Clamps an rgb int value to the allowable range.intCompares this object with the specified object for order.booleanEquality is based on either reference equality or GUID.abstract intUsed to determine display order, lower first.final DisplayTypeDisplayType enum for the object.final StringgetGuid()Dash-delimited GUID for the display object in the form of "modid-displayType-displayId".final StringgetId()A unique id for the object.final StringgetModId()Your mod id.inthashCode()
-
Field Details
-
modId
-
id
-
displayType
-
-
Constructor Details
-
Displayable
Constructor with explicit display id.- Parameters:
modId- the mod id
-
-
Method Details
-
clampRGB
public static int clampRGB(int rgb) Clamps an rgb int value to the allowable range. If an ARGB value is passed in, alpha is masked to FF.- Parameters:
rgb- color- Returns:
- clamped color
-
clampOpacity
public static float clampOpacity(float opacity) Clamps an rgb int value to the allowable range of 0F-1F.- Parameters:
opacity- opacity- Returns:
- clamped opacity
-
getDisplayOrder
public abstract int getDisplayOrder()Used to determine display order, lower first.- Returns:
- order
-
getModId
Your mod id.- Returns:
- modId mod id
-
getId
A unique id for the object. Uniqueness is only needed among instances of the same class.- Returns:
- displayId display id
-
getDisplayType
DisplayType enum for the object.- Returns:
- enum value
-
getGuid
Dash-delimited GUID for the display object in the form of "modid-displayType-displayId".- Returns:
- the guid
-
equals
Equality is based on either reference equality or GUID. -
hashCode
public int hashCode() -
compareTo
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.- Specified by:
compareToin interfaceComparable<Displayable>- Parameters:
o- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
NullPointerException- if the specified object is nullClassCastException- if the specified object's type prevents it from being compared to this object.
-