Class RelativeHitboxInfoBuilderImpl
java.lang.Object
com.hammy275.immersivemc.client.immersive.RelativeHitboxInfoBuilderImpl
- All Implemented Interfaces:
RelativeHitboxInfoBuilder
,Cloneable
public class RelativeHitboxInfoBuilderImpl
extends Object
implements RelativeHitboxInfoBuilder, Cloneable
-
Constructor Summary
ConstructorDescriptionRelativeHitboxInfoBuilderImpl
(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size, boolean constantOffset) RelativeHitboxInfoBuilderImpl
(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ, boolean constantOffset) RelativeHitboxInfoBuilderImpl
(net.minecraft.world.phys.Vec3 centerOffset, double size) RelativeHitboxInfoBuilderImpl
(net.minecraft.world.phys.Vec3 centerOffset, double sizeX, double sizeY, double sizeZ) -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build this builder into a proper relative hitbox.clone()
create
(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size) Create a RelativeHitboxInfoBuilder offset by some amount with some size.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.create
(net.minecraft.world.phys.Vec3 centerOffset, double size) Create a RelativeHitboxInfoBuilder offset by some amount with some size.create
(net.minecraft.world.phys.Vec3 centerOffset, double sizeX, double sizeY, double sizeZ) Create a RelativeHitboxInfoBuilder offset by some amount with some size.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.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)
-
Constructor Details
-
RelativeHitboxInfoBuilderImpl
public RelativeHitboxInfoBuilderImpl(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size, boolean constantOffset) -
RelativeHitboxInfoBuilderImpl
public RelativeHitboxInfoBuilderImpl(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ, boolean constantOffset) -
RelativeHitboxInfoBuilderImpl
public RelativeHitboxInfoBuilderImpl(net.minecraft.world.phys.Vec3 centerOffset, double size) -
RelativeHitboxInfoBuilderImpl
public RelativeHitboxInfoBuilderImpl(net.minecraft.world.phys.Vec3 centerOffset, double sizeX, double sizeY, double sizeZ)
-
-
Method Details
-
setCenterOffset
public RelativeHitboxInfoBuilderImpl setCenterOffset(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> newOffset) Description copied from interface:RelativeHitboxInfoBuilder
Set the offset from the starting position for this relative hitbox. SeeHitboxPositioningMode
for more info on how this positioning works.- Specified by:
setCenterOffset
in interfaceRelativeHitboxInfoBuilder
- 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.
-
setCenterOffset
Description copied from interface:RelativeHitboxInfoBuilder
Set the offset from the starting position for this relative hitbox. SeeHitboxPositioningMode
for more info on how this positioning works.- Specified by:
setCenterOffset
in interfaceRelativeHitboxInfoBuilder
- Parameters:
newOffset
- The offset in blocks from the center this hitbox should be placed at.- Returns:
- This builder object.
-
holdsItems
- Specified by:
holdsItems
in interfaceRelativeHitboxInfoBuilder
- Parameters:
holdsItems
- Whether this relative hitbox should hold items.- Returns:
- This builder object.
-
isInput
- Specified by:
isInput
in interfaceRelativeHitboxInfoBuilder
- 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
- Specified by:
itemSpins
in interfaceRelativeHitboxInfoBuilder
- 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
- Specified by:
itemRenderSizeMultiplier
in interfaceRelativeHitboxInfoBuilder
- Parameters:
multiplier
- A multiplier for the size of the item when rendering.- Returns:
- This builder object.
-
triggerHitbox
- Specified by:
triggerHitbox
in interfaceRelativeHitboxInfoBuilder
- 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
public RelativeHitboxInfoBuilderImpl textSupplier(Function<BuiltImmersiveInfoImpl<?>, List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, net.minecraft.world.phys.Vec3>>> textSupplier) - Specified by:
textSupplier
in interfaceRelativeHitboxInfoBuilder
- 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
- Specified by:
forceUpDownRenderDir
in interfaceRelativeHitboxInfoBuilder
- 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
- Specified by:
needs3DResourcePackCompat
in interfaceRelativeHitboxInfoBuilder
- Parameters:
needs3dCompat
- Whether this hitbox should be moved on the Z axis for 3D resource packs.- Returns:
- This builder object.
-
setVRMovementInfo
- Specified by:
setVRMovementInfo
in interfaceRelativeHitboxInfoBuilder
- Parameters:
vrMovementInfo
- How this hitbox should react to VR hand movements.- Returns:
- This builder object.
-
renderItem
- Specified by:
renderItem
in interfaceRelativeHitboxInfoBuilder
- Parameters:
renderItem
- Whether this hitbox should render the item it contains, if it contains one.- Returns:
- This builder object.
-
renderItemCount
- Specified by:
renderItemCount
in interfaceRelativeHitboxInfoBuilder
- Parameters:
renderItemCount
- Whether this hitbox should render the item count if it's rendering an item.- Returns:
- This builder object.
-
build
Description copied from interface:RelativeHitboxInfoBuilder
Build this builder into a proper relative hitbox.- Specified by:
build
in interfaceRelativeHitboxInfoBuilder
- Returns:
- A built relative hitbox.
-
create
public static RelativeHitboxInfoBuilderImpl create(net.minecraft.world.phys.Vec3 centerOffset, double size) Description copied from interface:RelativeHitboxInfoBuilder
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
public static RelativeHitboxInfoBuilderImpl create(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size) Description copied from interface:RelativeHitboxInfoBuilder
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
public static RelativeHitboxInfoBuilderImpl create(net.minecraft.world.phys.Vec3 centerOffset, double sizeX, double sizeY, double sizeZ) Description copied from interface:RelativeHitboxInfoBuilder
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
public static RelativeHitboxInfoBuilderImpl create(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ) Description copied from interface:RelativeHitboxInfoBuilder
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
public static RelativeHitboxInfoBuilderImpl createItemInput(net.minecraft.world.phys.Vec3 centerOffset, double size) Description copied from interface:RelativeHitboxInfoBuilder
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
public static RelativeHitboxInfoBuilderImpl createItemInput(Function<BuiltImmersiveInfoImpl<?>, net.minecraft.world.phys.Vec3> centerOffset, double size) Description copied from interface:RelativeHitboxInfoBuilder
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.
-
clone
-