Record Class BattleSceneMarker
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.scene.BattleSceneMarker
- Record Components:
type- the marker type, such asPLAYER_POS,PIXELMON_POS, orTRAINER_POSid- the marker id within that type, or an empty string for idless markersblockPos- the block position for the markerposition- the precise render position for entities or cameras placed at this markeryaw- the yaw to apply to placed entities or cameraspitch- the pitch to apply to placed entities or cameras
public record BattleSceneMarker(String type, String id, net.minecraft.core.BlockPos blockPos, net.minecraft.world.phys.Vec3 position, float yaw, float pitch)
extends Record
Marker extracted from a structure block in data mode.
Marker metadata uses type, type;id, type;yaw, type;yaw;pitch,
type;id;yaw, or type;id;yaw;pitch. The yaw segment is optional and falls back to the structure
block rotation when absent or invalid. Pitch defaults to 0. The type;yaw and
type;yaw;pitch formats are only used by markers that do not use ids, such as player_pos.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBattleSceneMarker(String type, String id, net.minecraft.core.BlockPos blockPos, net.minecraft.world.phys.Vec3 position, float yaw, float pitch) Creates an instance of aBattleSceneMarkerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringallyPixelmon(int slot) static StringallyTrainer(int slot) net.minecraft.core.BlockPosblockPos()Returns the value of theblockPosrecord component.static BattleSceneMarkerdecode(net.minecraft.network.FriendlyByteBuf buffer) Decodes a marker from a battle scene packet.voidencode(net.minecraft.network.FriendlyByteBuf buffer) Encodes this marker for a battle scene packet.final booleanIndicates whether some other object is "equal to" this one.static @Nullable BattleSceneMarkerAttempts to convert a structure block into a battle scene marker.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleanChecks whether this marker has the supplied type.booleanChecks whether this marker has the supplied type and id.offset(net.minecraft.core.BlockPos offset) Returns a copy of this marker shifted by the supplied offset.static StringopponentPixelmon(int slot) static StringopponentTrainer(int slot) floatpitch()Returns the value of thepitchrecord component.static StringBuilds a Pokemon marker id from a side and battle slot.static StringplayerPixelmon(int slot) net.minecraft.world.phys.Vec3position()Returns the value of thepositionrecord component.rotateYaw(net.minecraft.world.level.block.Rotation structureRotation, float markerYawOffset) Returns a copy of this marker with its yaw adjusted by the supplied scene rotations.final StringtoString()Returns a string representation of this record class.static StringBuilds a trainer marker id from a side and battle slot.type()Returns the value of thetyperecord component.floatyaw()Returns the value of theyawrecord component.
-
Field Details
-
PLAYER_POS
- See Also:
-
PIXELMON_POS
- See Also:
-
TRAINER_POS
- See Also:
-
CAMERA_POS
- See Also:
-
PLAYER
- See Also:
-
ALLY
- See Also:
-
OPPONENT
- See Also:
-
-
Constructor Details
-
BattleSceneMarker
public BattleSceneMarker(String type, String id, net.minecraft.core.BlockPos blockPos, net.minecraft.world.phys.Vec3 position, float yaw, float pitch) Creates an instance of aBattleSceneMarkerrecord class.- Parameters:
type- the value for thetyperecord componentid- the value for theidrecord componentblockPos- the value for theblockPosrecord componentposition- the value for thepositionrecord componentyaw- the value for theyawrecord componentpitch- the value for thepitchrecord component
-
-
Method Details
-
fromStructureBlock
Attempts to convert a structure block into a battle scene marker.- Parameters:
block- the structure block data to parse- Returns:
- the marker, or
nullif the block is not a valid marker
-
is
Checks whether this marker has the supplied type.- Parameters:
type- the marker type to match- Returns:
- true when the marker type matches
-
is
Checks whether this marker has the supplied type and id.- Parameters:
type- the marker type to matchid- the marker id to match- Returns:
- true when both marker fields match
-
pixelmon
Builds a Pokemon marker id from a side and battle slot.- Parameters:
side- the marker sideslot- the zero-based battle slot- Returns:
- a marker id such as
ally_0
-
playerPixelmon
- Parameters:
slot- the zero-based player Pokemon slot- Returns:
- the marker id for a player Pokemon slot
-
allyPixelmon
- Parameters:
slot- the zero-based ally Pokemon slot- Returns:
- the marker id for an ally Pokemon slot
-
opponentPixelmon
- Parameters:
slot- the zero-based opponent Pokemon slot- Returns:
- the marker id for an opponent Pokemon slot
-
trainer
Builds a trainer marker id from a side and battle slot.- Parameters:
side- the marker sideslot- the zero-based battle slot- Returns:
- a marker id such as
opponent_0
-
allyTrainer
- Parameters:
slot- the zero-based ally trainer slot- Returns:
- the marker id for an ally trainer slot
-
opponentTrainer
- Parameters:
slot- the zero-based opponent trainer slot- Returns:
- the marker id for an opponent trainer slot
-
offset
Returns a copy of this marker shifted by the supplied offset.- Parameters:
offset- the block position offset to apply- Returns:
- the shifted marker
-
rotateYaw
public BattleSceneMarker rotateYaw(net.minecraft.world.level.block.Rotation structureRotation, float markerYawOffset) Returns a copy of this marker with its yaw adjusted by the supplied scene rotations.- Parameters:
structureRotation- the block-grid rotation applied around the player anchormarkerYawOffset- arbitrary yaw offset to add after the structure rotation- Returns:
- the rotated marker
-
decode
Decodes a marker from a battle scene packet.- Parameters:
buffer- the packet buffer to read from- Returns:
- the decoded marker
-
encode
public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes this marker for a battle scene packet.- Parameters:
buffer- the packet buffer to write to
-
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
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
blockPos
public net.minecraft.core.BlockPos blockPos()Returns the value of theblockPosrecord component.- Returns:
- the value of the
blockPosrecord component
-
position
public net.minecraft.world.phys.Vec3 position()Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
yaw
public float yaw()Returns the value of theyawrecord component.- Returns:
- the value of the
yawrecord component
-
pitch
public float pitch()Returns the value of thepitchrecord component.- Returns:
- the value of the
pitchrecord component
-