Class RelativeHitboxInfoImpl
java.lang.Object
com.hammy275.immersivemc.client.immersive.RelativeHitboxInfoImpl
- All Implemented Interfaces:
- RelativeHitboxInfo,- HitboxInfo,- Cloneable
public class RelativeHitboxInfoImpl
extends Object
implements RelativeHitboxInfo, HitboxInfo, Cloneable
- 
Field SummaryFieldsModifier and TypeFieldDescriptionfinal Function<BuiltImmersiveInfo<?>, net.minecraft.world.phys.Vec3> final booleanfinal Function<BuiltImmersiveInfo<?>, ForcedUpDownRenderDir> final booleanfinal booleanfinal booleanfinal booleannet.minecraft.world.item.ItemStackfinal floatfinal booleanfinal booleanfinal booleanfinal booleanfinal doublefinal doublefinal doublefinal Function<BuiltImmersiveInfo<?>, List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, net.minecraft.world.phys.Vec3>>> final HitboxVRMovementInfo
- 
Constructor SummaryConstructorsConstructorDescriptionRelativeHitboxInfoImpl(RelativeHitboxInfoBuilderImpl usedBuilder, Function<BuiltImmersiveInfo<?>, net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ, boolean holdsItems, boolean isInput, boolean itemSpins, float itemRenderSizeMultiplier, boolean isTriggerHitbox, Function<BuiltImmersiveInfo<?>, List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, net.minecraft.world.phys.Vec3>>> textSupplier, Function<BuiltImmersiveInfo<?>, ForcedUpDownRenderDir> forcedUpDownDir, boolean constantOffset, boolean needs3dCompat, HitboxVRMovementInfo vrMovementInfo, boolean renderItem, boolean renderItemCount, boolean forcedUpDownRenderDirConstant) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionbooleancalcDone()clone()cloneWithAddedOffset(net.minecraft.world.phys.Vec3 offset) Clones this HitboxInfo, offsetting the position by the supplied offset.cloneWithNewOffset(Function<BuiltImmersiveInfo<?>, net.minecraft.world.phys.Vec3> newOffset) Clones this HitboxInfo replacing the offset with the supplied one.voidForce the position and box of this hitbox to be null.net.minecraft.world.phys.AABBgetAABB()net.minecraft.world.phys.AABBgetRenderHitbox(float partialTick) net.minecraft.core.DirectionbooleanhasAABB()booleanvoidvoidrecalculate(net.minecraft.world.level.Level level, HitboxPositioningMode mode, BuiltImmersiveInfoImpl<?> info) Main external function call.
- 
Field Details- 
centerOffset
- 
sizeXpublic final double sizeX
- 
sizeYpublic final double sizeY
- 
sizeZpublic final double sizeZ
- 
isInputpublic final boolean isInput
- 
holdsItemspublic final boolean holdsItems
- 
itemSpinspublic final boolean itemSpins
- 
itemRenderSizeMultiplierpublic final float itemRenderSizeMultiplier
- 
isTriggerHitboxpublic final boolean isTriggerHitbox
- 
textSupplierpublic final Function<BuiltImmersiveInfo<?>,List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, textSuppliernet.minecraft.world.phys.Vec3>>> 
- 
forcedUpDownRenderDir
- 
constantOffsetpublic final boolean constantOffset
- 
needs3dCompatpublic final boolean needs3dCompat
- 
vrMovementInfo
- 
renderItempublic final boolean renderItem
- 
renderItemCountpublic final boolean renderItemCount
- 
forcedUpDownRenderDirConstantpublic final boolean forcedUpDownRenderDirConstant
- 
itempublic net.minecraft.world.item.ItemStack item
 
- 
- 
Constructor Details- 
RelativeHitboxInfoImplpublic RelativeHitboxInfoImpl(RelativeHitboxInfoBuilderImpl usedBuilder, Function<BuiltImmersiveInfo<?>, net.minecraft.world.phys.Vec3> centerOffset, double sizeX, double sizeY, double sizeZ, boolean holdsItems, boolean isInput, boolean itemSpins, float itemRenderSizeMultiplier, boolean isTriggerHitbox, Function<BuiltImmersiveInfo<?>, List<com.mojang.datafixers.util.Pair<net.minecraft.network.chat.Component, net.minecraft.world.phys.Vec3>>> textSupplier, Function<BuiltImmersiveInfo<?>, ForcedUpDownRenderDir> forcedUpDownDir, boolean constantOffset, boolean needs3dCompat, HitboxVRMovementInfo vrMovementInfo, boolean renderItem, boolean renderItemCount, boolean forcedUpDownRenderDirConstant) Constructor. See the respective functions inRelativeHitboxInfoBuilderImplfor more information.- Parameters:
- usedBuilder- The builder used to create this HitboxInfo. Only used to allow cloning this hitbox.
- centerOffset- Function that takes an info instance and returns the offset from the center position for the location of this hitbox.
- sizeX- Size of hitbox on relative X axis.
- sizeY- Size of hitbox on relative Y axis.
- sizeZ- Size of hitbox on relative Z axis.
- holdsItems- Whether this hitbox holds items.
- isInput- Whether this hitbox is an input hitbox.
- itemSpins- Whether the item in this hitbox should spin.
- itemRenderSizeMultiplier- Multiplier to the size passed in the- ImmersiveBuilderImplfor the size the item should render at.
- isTriggerHitbox- Whether this hitbox is a trigger hitbox.
- textSupplier- A function taking an info instance and returning a list of text components.
- forcedUpDownDir- An override for upDownRenderDir to use instead of automatically determining it.
- constantOffset- Whether centerOffset's return value is constant.
- needs3dCompat- Whether the offset should be moved by a need for compatibility with 3D resource packs.
- vrMovementInfo- Hitbox VR movement info to recognize hand gestures and perform some action.
- renderItem- Whether to render the item in this hitbox if it can contain one.
- renderItemCount- Whether to render the item count in this hitbox if it can contain an item.
 
 
- 
- 
Method Details- 
forceNullpublic void forceNull()Force the position and box of this hitbox to be null.
- 
recalculatepublic void recalculate(net.minecraft.world.level.Level level, HitboxPositioningMode mode, BuiltImmersiveInfoImpl<?> info) Main external function call. Calculates the actual, in-world data from the relative information provided.- Parameters:
- level- Level instance.
- mode- Positioning mode. See- HitboxPositioningModefor what each mode does.
- info- Info instance.
 
- 
getRenderHitboxpublic net.minecraft.world.phys.AABB getRenderHitbox(float partialTick) - Specified by:
- getRenderHitboxin interface- HitboxInfo
- Parameters:
- partialTick- The partial tick between the current tick and the next.
- Returns:
- The bounding box to be used for rendering.
 
- 
onOrientationChangepublic void onOrientationChange()
- 
getAABBpublic net.minecraft.world.phys.AABB getAABB()- Returns:
- Literal AABB for this hitbox.
 
- 
getUpDownRenderDirpublic net.minecraft.core.Direction getUpDownRenderDir()
- 
hasAABBpublic boolean hasAABB()- Returns:
- Whether this has its calculated hitbox.
 
- 
getTextData
- 
calcDonepublic boolean calcDone()- Returns:
- Whether the relative to literal calculation has been performed at least one.
 
- 
clone
- 
cloneWithNewOffsetpublic RelativeHitboxInfoImpl cloneWithNewOffset(Function<BuiltImmersiveInfo<?>, net.minecraft.world.phys.Vec3> newOffset) Clones this HitboxInfo replacing the offset with the supplied one.- Parameters:
- newOffset- New offset for the clone.
- Returns:
- Clone with the offset replaced with newOffset.
 
- 
cloneWithAddedOffsetClones this HitboxInfo, offsetting the position by the supplied offset.- Specified by:
- cloneWithAddedOffsetin interface- RelativeHitboxInfo
- Parameters:
- offset- Offset relative to this HitboxInfo's offset.
- Returns:
- HitboxInfo that is offset by offset in comparison to this HitboxInfo.
 
- 
getBuilderClone- Specified by:
- getBuilderClonein interface- RelativeHitboxInfo
- Returns:
- A clone of this relative hitbox in builder form.
 
- 
getHitbox- Specified by:
- getHitboxin interface- HitboxInfo
- Returns:
- Get the actual hitbox used for collision, intersection, etc.
 
- 
isTriggerHitboxpublic boolean isTriggerHitbox()- Specified by:
- isTriggerHitboxin interface- HitboxInfo
- Returns:
- Whether this hitbox is a trigger hitbox. As of writing, this is if the break block button is required to be held while a hand is in this hitbox to activate it in VR.
 
 
-