Record Class BattleSceneMarker

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.scene.BattleSceneMarker
Record Components:
type - the marker type, such as PLAYER_POS, PIXELMON_POS, or TRAINER_POS
id - the marker id within that type, or an empty string for idless markers
blockPos - the block position for the marker
position - the precise render position for entities or cameras placed at this marker
yaw - the yaw to apply to placed entities or cameras
pitch - 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 Details

  • 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 a BattleSceneMarker record class.
      Parameters:
      type - the value for the type record component
      id - the value for the id record component
      blockPos - the value for the blockPos record component
      position - the value for the position record component
      yaw - the value for the yaw record component
      pitch - the value for the pitch record component
  • Method Details

    • fromStructureBlock

      @Nullable public static @Nullable BattleSceneMarker fromStructureBlock(BattleSceneBlockData block)
      Attempts to convert a structure block into a battle scene marker.
      Parameters:
      block - the structure block data to parse
      Returns:
      the marker, or null if the block is not a valid marker
    • is

      public boolean is(String type)
      Checks whether this marker has the supplied type.
      Parameters:
      type - the marker type to match
      Returns:
      true when the marker type matches
    • is

      public boolean is(String type, String id)
      Checks whether this marker has the supplied type and id.
      Parameters:
      type - the marker type to match
      id - the marker id to match
      Returns:
      true when both marker fields match
    • pixelmon

      public static String pixelmon(String side, int slot)
      Builds a Pokemon marker id from a side and battle slot.
      Parameters:
      side - the marker side
      slot - the zero-based battle slot
      Returns:
      a marker id such as ally_0
    • playerPixelmon

      public static String playerPixelmon(int slot)
      Parameters:
      slot - the zero-based player Pokemon slot
      Returns:
      the marker id for a player Pokemon slot
    • allyPixelmon

      public static String allyPixelmon(int slot)
      Parameters:
      slot - the zero-based ally Pokemon slot
      Returns:
      the marker id for an ally Pokemon slot
    • opponentPixelmon

      public static String opponentPixelmon(int slot)
      Parameters:
      slot - the zero-based opponent Pokemon slot
      Returns:
      the marker id for an opponent Pokemon slot
    • trainer

      public static String trainer(String side, int slot)
      Builds a trainer marker id from a side and battle slot.
      Parameters:
      side - the marker side
      slot - the zero-based battle slot
      Returns:
      a marker id such as opponent_0
    • allyTrainer

      public static String allyTrainer(int slot)
      Parameters:
      slot - the zero-based ally trainer slot
      Returns:
      the marker id for an ally trainer slot
    • opponentTrainer

      public static String opponentTrainer(int slot)
      Parameters:
      slot - the zero-based opponent trainer slot
      Returns:
      the marker id for an opponent trainer slot
    • offset

      public BattleSceneMarker offset(net.minecraft.core.BlockPos 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 anchor
      markerYawOffset - arbitrary yaw offset to add after the structure rotation
      Returns:
      the rotated marker
    • decode

      public static BattleSceneMarker decode(net.minecraft.network.FriendlyByteBuf buffer)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • blockPos

      public net.minecraft.core.BlockPos blockPos()
      Returns the value of the blockPos record component.
      Returns:
      the value of the blockPos record component
    • position

      public net.minecraft.world.phys.Vec3 position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • yaw

      public float yaw()
      Returns the value of the yaw record component.
      Returns:
      the value of the yaw record component
    • pitch

      public float pitch()
      Returns the value of the pitch record component.
      Returns:
      the value of the pitch record component