Interface RelativeHitboxInfoBuilder

All Known Implementing Classes:
RelativeHitboxInfoBuilderImpl

public interface RelativeHitboxInfoBuilder
A builder for RelativeHitboxInfo instances. For all BuiltImmersiveInfo instances provided by this class, BuiltImmersiveInfo.getExtraData() is safe to use, and will give an object with your valid data. You only need to cast it to your object type.
  • Method Details

    • setCenterOffset

      RelativeHitboxInfoBuilder setCenterOffset(net.minecraft.world.phys.Vec3 newOffset)
      Set the offset from the starting position for this relative hitbox. See HitboxPositioningMode for more info on how this positioning works.
      Parameters:
      newOffset - The offset in blocks from the center this hitbox should be placed at.
      Returns:
      This builder object.
    • setCenterOffset

      RelativeHitboxInfoBuilder setCenterOffset(Function<BuiltImmersiveInfoImpl<?>,net.minecraft.world.phys.Vec3> newOffset)
      Set the offset from the starting position for this relative hitbox. See HitboxPositioningMode for more info on how this positioning works.
      Parameters:
      newOffset - A function that returns the offset in blocks from the center this hitbox should be placed at. The function can return null if this hitbox shouldn't render or be interacted with.
      Returns:
      This builder object.
    • holdsItems

      RelativeHitboxInfoBuilder holdsItems(boolean holdsItems)
      Parameters:
      holdsItems - Whether this relative hitbox should hold items.
      Returns:
      This builder object.
    • isInput

      RelativeHitboxInfoBuilder isInput(boolean isInput)
      Parameters:
      isInput - Relative this relative hitbox is an input. If this relative hitbox is both an input and holds items, it will render an item guide.
      Returns:
      This builder object.
    • itemSpins

      RelativeHitboxInfoBuilder itemSpins(boolean spins)
      Parameters:
      spins - Whether the item in this hitbox should rotate when displayed. This only matters if this hitbox already holds items.
      Returns:
      This builder object.
    • itemRenderSizeMultiplier

      RelativeHitboxInfoBuilder itemRenderSizeMultiplier(float multiplier)
      Parameters:
      multiplier - A multiplier for the size of the item when rendering.
      Returns:
      This builder object.
    • triggerHitbox

      RelativeHitboxInfoBuilder triggerHitbox(boolean isTriggerHitbox)
      Parameters:
      isTriggerHitbox - Whether this hitbox should act as a trigger hitbox, meaning it will require the break block button to pressed when a controller is inside of it in VR.
      Returns:
      This builder object.
    • textSupplier

      RelativeHitboxInfoBuilder textSupplier(Function<BuiltImmersiveInfoImpl<?>,List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component,net.minecraft.world.phys.Vec3>>> textSupplier)
      Parameters:
      textSupplier - A function that provides a list of text components to render and the relative offset from the center offset to render the text at.
      Returns:
      This builder object.
    • forceUpDownRenderDir

      RelativeHitboxInfoBuilder forceUpDownRenderDir(ForcedUpDownRenderDir forcedDir)
      Parameters:
      forcedDir - Forces the direction passed to upDown ImmersiveRenderHelpers.renderItem(ItemStack, PoseStack, float, BoundingBox, boolean, int, Float, Direction, Direction) instead of determining it based on the hitbox positioning mode.
      Returns:
      This builder object.
    • needs3DResourcePackCompat

      RelativeHitboxInfoBuilder needs3DResourcePackCompat(boolean needs3dCompat)
      Parameters:
      needs3dCompat - Whether this hitbox should be moved on the Z axis for 3D resource packs.
      Returns:
      This builder object.
    • setVRMovementInfo

      @Beta RelativeHitboxInfoBuilder setVRMovementInfo(HitboxVRMovementInfo vrMovementInfo)
      Parameters:
      vrMovementInfo - How this hitbox should react to VR hand movements.
      Returns:
      This builder object.
    • renderItem

      RelativeHitboxInfoBuilder renderItem(boolean renderItem)
      Parameters:
      renderItem - Whether this hitbox should render the item it contains, if it contains one.
      Returns:
      This builder object.
    • renderItemCount

      RelativeHitboxInfoBuilder renderItemCount(boolean renderItemCount)
      Parameters:
      renderItemCount - Whether this hitbox should render the item count if it's rendering an item.
      Returns:
      This builder object.
    • build

      Build this builder into a proper relative hitbox.
      Returns:
      A built relative hitbox.
    • create

      static RelativeHitboxInfoBuilder create(net.minecraft.world.phys.Vec3 centerOffset, double size)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size.
      Parameters:
      centerOffset - The relative offset from the center.
      size - The size of this hitbox, in blocks.
      Returns:
      A builder object.
    • create

      static RelativeHitboxInfoBuilder create(Function<BuiltImmersiveInfoImpl<?>,net.minecraft.world.phys.Vec3> centerOffset, double size)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size.
      Parameters:
      centerOffset - The function to calculate the relative offset from the center. The function return null to denote no hitbox.
      size - The size of this hitbox, in blocks.
      Returns:
      A builder object.
    • create

      static RelativeHitboxInfoBuilder create(net.minecraft.world.phys.Vec3 centerOffset, double sizeX, double sizeY, double sizeZ)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size.
      Parameters:
      centerOffset - The relative offset from the center.
      sizeX - The size of this box on the relative x-axis.
      sizeY - The size of this box on the relative y-axis.
      sizeZ - The size of this box on the relative z-axis.
      Returns:
      A builder object.
    • create

      static RelativeHitboxInfoBuilder create(Function<BuiltImmersiveInfoImpl<?>,net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size.
      Parameters:
      centerOffset - The function to calculate the relative offset from the center. The function can return null to denote no hitbox.
      sizeX - The size of this box on the relative x-axis.
      sizeY - The size of this box on the relative y-axis.
      sizeZ - The size of this box on the relative z-axis.
      Returns:
      A builder object.
    • createItemInput

      static RelativeHitboxInfoBuilder createItemInput(net.minecraft.world.phys.Vec3 centerOffset, double size)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size that accepts items from players.
      Parameters:
      centerOffset - The relative offset from the center.
      size - The size of this hitbox, in blocks.
      Returns:
      A builder object.
    • createItemInput

      static RelativeHitboxInfoBuilder createItemInput(Function<BuiltImmersiveInfoImpl<?>,net.minecraft.world.phys.Vec3> centerOffset, double size)
      Create a RelativeHitboxInfoBuilder offset by some amount with some size that accepts items from players.
      Parameters:
      centerOffset - The function to calculate the relative offset from the center. The function can return null to denote no hitbox.
      size - The size of this hitbox, in blocks.
      Returns:
      A builder object.