Package net.nullved.pmweatherapi.radar
Class RadarMode
java.lang.Object
net.nullved.pmweatherapi.radar.RadarMode
- All Implemented Interfaces:
Comparable<RadarMode>,net.minecraft.util.StringRepresentable
public class RadarMode
extends Object
implements net.minecraft.util.StringRepresentable, Comparable<RadarMode>
A class representing a Radar Mode.
To register your own radar mode, you must call
For each radar mode, you must define a function taking in a
You can also define a custom dot color with
You may also be looking to overlay something on top of the radar instead. If this is what you are looking to do, checkout
To register your own radar mode, you must call
create(net.minecraft.resources.ResourceLocation, java.util.function.Function<net.nullved.pmweatherapi.client.render.PixelRenderData, java.awt.Color>, java.awt.Color) somewhere from your MAIN MOD CLASS CONSTRUCTOR.
This is to ensure the radar mode gets added to PMWExtras.RADAR_MODE so that it will be recognized by Minecraft as a valid property value
For each radar mode, you must define a function taking in a
PixelRenderData and returning a Color.
This function is run for every pixel on the radar, so try to make it performant.
You can also define a custom dot color with
create(ResourceLocation, Function, Color) (this supports transparency)
You may also be looking to overlay something on top of the radar instead. If this is what you are looking to do, checkout
RadarOverlays instead- Since:
- 0.14.15.6
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.util.StringRepresentable
net.minecraft.util.StringRepresentable.EnumCodec<E extends Enum<E> & net.minecraft.util.StringRepresentable>, net.minecraft.util.StringRepresentable.StringRepresentableCodec<S extends net.minecraft.util.StringRepresentable> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RadarModeA Radar Mode that is a copy of PMWeather's IRstatic final RadarModeA "Null" Radar Mode mimicking Minecraft's missing texture.static final RadarModeA Radar Mode that is a copy of PMWeather's Reflectivitystatic final RadarModeA Radar Mode that is a copy of PMWeather's VelocityFields inherited from interface net.minecraft.util.StringRepresentable
PRE_BUILT_MAP_THRESHOLD -
Method Summary
Modifier and TypeMethodDescriptionintstatic RadarModecreate(net.minecraft.resources.ResourceLocation id, Function<PixelRenderData, Color> colorFunction) Create a newRadarModewith a red dot at the center.static RadarModecreate(net.minecraft.resources.ResourceLocation id, Function<PixelRenderData, Color> colorFunction, Color renderDotColor) Create a newRadarModecycle()Gets the nextRadarModein the cyclestatic RadarModeGets a specificRadarModebased on ID in string formatstatic RadarModeget(net.minecraft.resources.ResourceLocation id) Gets a specificRadarModebased on IDgetColorForPixel(PixelRenderData pixelRenderData) Gets the color for a certain pixel.Gets the color of the dot at the center of the radarnet.minecraft.resources.ResourceLocationgetId()Gets theResourceLocationof the radar modeGets the serialized name of theRadarModeGets thisRadarModeexpressed as aStringValuestatic Collection<RadarMode> values()Returns aCollectionofRadarModes
-
Field Details
-
NULL
A "Null" Radar Mode mimicking Minecraft's missing texture. This radar mode is not accessible by normal means, and if you see it that is an error.- Since:
- 0.14.15.6
-
REFLECTIVITY
A Radar Mode that is a copy of PMWeather's Reflectivity- Since:
- 0.14.15.6
-
VELOCITY
A Radar Mode that is a copy of PMWeather's Velocity- Since:
- 0.14.15.6
-
IR
A Radar Mode that is a copy of PMWeather's IR- Since:
- 0.15.0.0
-
-
Method Details
-
create
public static RadarMode create(net.minecraft.resources.ResourceLocation id, Function<PixelRenderData, Color> colorFunction, Color renderDotColor) Create a newRadarMode- Parameters:
id- TheResourceLocationof this radar modecolorFunction- TheFunctionmapping aPixelRenderDatato aColor. Runs for every pixelrenderDotColor- TheColorof the dot. Supports transparency- Returns:
- A new
RadarMode - Since:
- 0.14.15.6
-
create
public static RadarMode create(net.minecraft.resources.ResourceLocation id, Function<PixelRenderData, Color> colorFunction) Create a newRadarModewith a red dot at the center. To set a custom dot color, usecreate(ResourceLocation, Function, Color)- Parameters:
id- TheResourceLocationof this radar modecolorFunction- TheFunctionmapping aPixelRenderDatato aColor. Runs for every pixel- Returns:
- A new
RadarMode - Since:
- 0.14.15.6
-
values
Returns aCollectionofRadarModes- Returns:
- All Radar Modes
- Since:
- 0.14.15.6
-
get
Gets a specificRadarModebased on ID -
get
Gets a specificRadarModebased on ID in string format -
cycle
Gets the nextRadarModein the cycle- Returns:
- The next
RadarMode - Since:
- 0.14.15.6
-
getId
public net.minecraft.resources.ResourceLocation getId()Gets theResourceLocationof the radar mode- Returns:
- The
ResourceLocationof this radar mode
-
getDotColor
Gets the color of the dot at the center of the radar- Returns:
- The dot
Color - Since:
- 0.14.15.6
-
getColorForPixel
Gets the color for a certain pixel. Applies the function from thecreate(net.minecraft.resources.ResourceLocation, java.util.function.Function<net.nullved.pmweatherapi.client.render.PixelRenderData, java.awt.Color>, java.awt.Color)method- Parameters:
pixelRenderData- ThePixelRenderDataof the pixel- Returns:
- The
Colorto draw to the pixel - Since:
- 0.14.15.6
-
stringValue
Gets thisRadarModeexpressed as aStringValue- Returns:
- A
StringValue - Since:
- 0.14.15.6
-
getSerializedName
Gets the serialized name of theRadarMode- Specified by:
getSerializedNamein interfacenet.minecraft.util.StringRepresentable- Returns:
- The serialized name
- Since:
- 0.14.15.6
-
compareTo
Compares thisRadarModeto the givenRadarMode. Used to efficiently search for the nextRadarModein the cycle- Specified by:
compareToin interfaceComparable<RadarMode>- Parameters:
o- The otherRadarMode- Returns:
- 0 if same position in the cycle, 1 if later, -1 if earlier
- Since:
- 0.14.15.6
-