Record Class MapDecoration
java.lang.Object
java.lang.Record
net.minecraft.world.level.saveddata.maps.MapDecoration
public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComponentThe field for thenamerecord component.private final byteThe field for therotrecord component.private final it.unimi.dsi.fastutil.ints.Int2BooleanFunctionThe field for theshouldRenderForIndexrecord component.private final MapDecoration.TypeThe field for thetyperecord component.private final byteThe field for thexrecord component.private final byteThe field for theyrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionMapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, Component name) MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex) Creates an instance of aMapDecorationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.bytegetImage()final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.booleanrender(int index) Renders this decoration, useful for custom sprite sheets.booleanbyterot()Returns the value of therotrecord component.it.unimi.dsi.fastutil.ints.Int2BooleanFunctionReturns the value of theshouldRenderForIndexrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.bytex()Returns the value of thexrecord component.bytey()Returns the value of theyrecord component.
-
Field Details
-
type
The field for thetyperecord component. -
x
private final byte xThe field for thexrecord component. -
y
private final byte yThe field for theyrecord component. -
rot
private final byte rotThe field for therotrecord component. -
name
The field for thenamerecord component. -
shouldRenderForIndex
private final it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndexThe field for theshouldRenderForIndexrecord component.
-
-
Constructor Details
-
MapDecoration
-
MapDecoration
public MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex) Creates an instance of aMapDecorationrecord class.- Parameters:
type- the value for thetyperecord componentx- the value for thexrecord componenty- the value for theyrecord componentrot- the value for therotrecord componentname- the value for thenamerecord componentshouldRenderForIndex- the value for theshouldRenderForIndexrecord component
-
-
Method Details
-
getImage
public byte getImage() -
renderOnFrame
public boolean renderOnFrame() -
render
public boolean render(int index) Renders this decoration, useful for custom sprite sheets.- Parameters:
index- The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting- Returns:
- false to run vanilla logic for this decoration, true to skip it
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
x
public byte x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public byte y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
rot
public byte rot()Returns the value of therotrecord component.- Returns:
- the value of the
rotrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
shouldRenderForIndex
public it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex()Returns the value of theshouldRenderForIndexrecord component.- Returns:
- the value of the
shouldRenderForIndexrecord component
-