Class ToolOperation

java.lang.Object
com.hypixel.hytale.builtin.buildertools.tooloperations.ToolOperation
All Implemented Interfaces:
TriIntObjPredicate<Void>
Direct Known Subclasses:
LaserPointerOperation, LayersOperation, NoiseOperation, OldSculptOperation, PaintOperation, RevolveOperation, ScatterOperation, SculptOperation, SmootherOperation, SmoothOperation, TintOperation

public abstract class ToolOperation extends Object implements TriIntObjPredicate<Void>
  • Field Details

    • OPERATIONS

      @Nonnull public static final Map<String, OperationFactory> OPERATIONS
      A map of operations that are available to be created as instances.
    • PROTOTYPE_TOOL_SETTINGS

      @Nonnull public static final Map<UUID, PrototypePlayerBuilderToolSettings> PROTOTYPE_TOOL_SETTINGS
      A map of player builder tool settings, mapped by the players UUID instance.
    • MAX_DISTANCE

      public static final double MAX_DISTANCE
      The maximum distance, in blocks, in which we can target.
      See Also:
    • DEFAULT_BRUSH_SPACING

      public static final int DEFAULT_BRUSH_SPACING
      Default brush spacing when not specified by tool args. 0 = automatic (50% of brush size), >0 = number of blocks between executions.
      See Also:
    • DEFAULT_BRUSH_SIZE

      public static final int DEFAULT_BRUSH_SIZE
      Brush width and height when the tool args carry neither, because both are optional.
      See Also:
  • Constructor Details

  • Method Details

    • getOrCreatePrototypeSettings

      @Nonnull public static PrototypePlayerBuilderToolSettings getOrCreatePrototypeSettings(UUID playerUuid)
    • calculateInterpolatedPositions

      @Nonnull public static List<org.joml.Vector3i> calculateInterpolatedPositions(@Nullable org.joml.Vector3i lastPosition, @Nonnull org.joml.Vector3i currentPosition, int brushWidth, int brushHeight, int brushSpacing)
      Calculates positions to execute the brush at based on spacing settings.
      Parameters:
      lastPosition - The previous brush position (can be null for first stroke)
      currentPosition - The current brush position
      brushWidth - The width of the brush shape
      brushHeight - The height of the brush shape
      brushSpacing - 0 = automatic interpolation (50% of brush size), >0 = minimum blocks between executions (no interpolation)
      Returns:
      List of positions to execute the brush at (may be empty if spacing threshold not met)
    • getPosition

      @Nonnull public org.joml.Vector3i getPosition()
      Returns:
      the current position of this operation.
    • getBrushWidth

      public int getBrushWidth()
      Returns:
      the brush width (shapeRange) for this operation.
    • getBrushHeight

      public int getBrushHeight()
      Returns:
      the brush height for this operation.
    • getBrushSpacing

      public int getBrushSpacing()
      Gets the brush spacing value from tool args.
      Returns:
      The brush spacing: 0 = automatic (50% of brush size), >0 = blocks between executions.
    • getBrushRotation

      public Transform getBrushRotation(ComponentAccessor<EntityStore> componentAccessor)
      Gets the brush rotation value from tool args.
      Returns:
      The brush rotation as a transform.
    • executeAsBrushConfig

      public void executeAsBrushConfig(@Nonnull PrototypePlayerBuilderToolSettings prototypePlayerBuilderToolSettings, @Nonnull BuilderToolOnUseInteraction packet, ComponentAccessor<EntityStore> componentAccessor)
    • getTargetBlockAvoidingPaint

      @Nullable public org.joml.Vector3i getTargetBlockAvoidingPaint(@Nonnull Ref<EntityStore> ref, double maxDistance, @Nonnull ComponentAccessor<EntityStore> componentAccessor, float raycastOriginX, float raycastOriginY, float raycastOriginZ, float raycastDirectionX, float raycastDirectionY, float raycastDirectionZ)
    • getTargetBlockAvoidingPaint

      @Nullable public org.joml.Vector3i getTargetBlockAvoidingPaint(@Nonnull Ref<EntityStore> ref, double maxDistance, @Nonnull ComponentAccessor<EntityStore> componentAccessor, float raycastOriginX, float raycastOriginY, float raycastOriginZ, float raycastDirectionX, float raycastDirectionY, float raycastDirectionZ, @Nullable org.joml.Vector3d hitPositionOut)
    • getEditOperation

      @Nonnull public EditOperation getEditOperation()
    • test

      public final boolean test(int x, int y, int z, Void aVoid)
      Specified by:
      test in interface TriIntObjPredicate<Void>
    • showEditNotification

      public boolean showEditNotification()
    • getSkippedTints

      public long getSkippedTints()
      How many tints the tool dropped because the column they belong to is not loaded. A tint is column data, so it cannot be written where the column is absent.
    • execute

      public void execute(ComponentAccessor<EntityStore> componentAccessor)
    • executeAt

      public void executeAt(int posX, int posY, int posZ, ComponentAccessor<EntityStore> componentAccessor)
      Executes the brush operation at a specific position (for interpolation support).
      Parameters:
      posX - The x coordinate to execute at
      posY - The y coordinate to execute at
      posZ - The z coordinate to execute at
      componentAccessor - The component accessor
    • executeShapeOperation

      public static void executeShapeOperation(int x, int y, int z, @Nonnull TriIntObjPredicate<Void> operation, @Nonnull BrushShape shape, int shapeRange, int shapeHeight, int shapeThickness, boolean capped)
    • fromPacket

      @Nonnull public static ToolOperation fromPacket(@Nonnull Ref<EntityStore> ref, @Nonnull Player player, @Nonnull PlayerRef playerRef, @Nonnull BuilderToolOnUseInteraction packet, @Nonnull ComponentAccessor<EntityStore> componentAccessor) throws Exception
      Creates a new tool operation instance based on the information from the builder tool use interaction packet.
      Parameters:
      ref - The entity reference of the instigating player entity.
      player - The player component of the instigating player entity.
      packet - The packet that we are parsing from.
      componentAccessor - The ComponentAccessor for component access.
      Returns:
      a new ToolOperation instance from the operations factory.
      Throws:
      Exception - if no tool is found from the given ID.
    • combineMasks

      @Nullable public static BlockMask combineMasks(@Nullable BuilderTool.ArgData args, @Nullable BlockMask globalMask)