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 Summary
Modifier and TypeMethodDescriptionbuild()
Build this builder into a proper relative hitbox.static RelativeHitboxInfoBuilder
create
(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size) Create a RelativeHitboxInfoBuilder offset by some amount with some size.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.static RelativeHitboxInfoBuilder
create
(net.minecraft.world.phys.Vec3 centerOffset, double size) Create a RelativeHitboxInfoBuilder offset by some amount with some size.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.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.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.forceUpDownRenderDir
(ForcedUpDownRenderDir forcedDir) holdsItems
(boolean holdsItems) isInput
(boolean isInput) itemRenderSizeMultiplier
(float multiplier) itemSpins
(boolean spins) needs3DResourcePackCompat
(boolean needs3dCompat) renderItem
(boolean renderItem) renderItemCount
(boolean renderItemCount) setCenterOffset
(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> newOffset) Set the offset from the starting position for this relative hitbox.setCenterOffset
(net.minecraft.world.phys.Vec3 newOffset) Set the offset from the starting position for this relative hitbox.setVRMovementInfo
(HitboxVRMovementInfo vrMovementInfo) textSupplier
(Function<BuiltImmersiveInfoImpl<?>, List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, net.minecraft.world.phys.Vec3>>> textSupplier) triggerHitbox
(boolean isTriggerHitbox)
-
Method Details
-
setCenterOffset
Set the offset from the starting position for this relative hitbox. SeeHitboxPositioningMode
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. SeeHitboxPositioningMode
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
- Parameters:
holdsItems
- Whether this relative hitbox should hold items.- Returns:
- This builder object.
-
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
- 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
- Parameters:
multiplier
- A multiplier for the size of the item when rendering.- Returns:
- This builder object.
-
triggerHitbox
- 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
- Parameters:
forcedDir
- Forces the direction passed to upDownImmersiveRenderHelpers.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
- Parameters:
needs3dCompat
- Whether this hitbox should be moved on the Z axis for 3D resource packs.- Returns:
- This builder object.
-
setVRMovementInfo
- Parameters:
vrMovementInfo
- How this hitbox should react to VR hand movements.- Returns:
- This builder object.
-
renderItem
- Parameters:
renderItem
- Whether this hitbox should render the item it contains, if it contains one.- Returns:
- This builder object.
-
renderItemCount
- Parameters:
renderItemCount
- Whether this hitbox should render the item count if it's rendering an item.- Returns:
- This builder object.
-
build
RelativeHitboxInfo build()Build this builder into a proper relative hitbox.- Returns:
- A built relative hitbox.
-
create
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.
-