Class DragImmersiveInfo
java.lang.Object
com.hammy275.immersivemc.client.immersive.info.DragImmersiveInfo
- All Implemented Interfaces:
ImmersiveInfo
Info for Immersives that work by going to a hitbox, then dragging to other hitboxes, such as trapdoors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int[]final List<HitboxInfo> protected final net.minecraft.core.BlockPosintThe hitbox that needs to be started at to begin dragging, or -1 if one can start anywhere.int -
Constructor Summary
ConstructorsConstructorDescriptionDragImmersiveInfo(net.minecraft.core.BlockPos pos) DragImmersiveInfo(net.minecraft.core.BlockPos pos, int startingHitboxIndex) -
Method Summary
Modifier and TypeMethodDescriptionList<? extends HitboxInfo> net.minecraft.core.BlockPosGets the block position of the block this ImmersiveInfo represents.intgetSlotHovered(int handIndex) longbooleanWhether this ImmersiveInfo contains valid hitboxes that are ready for use by users in-game.voidsetSlotHovered(int hitboxIndex, int handIndex) A notification to mark the given slot as hovered by the given hand index.
-
Field Details
-
startingHitboxIndex
public int startingHitboxIndexThe hitbox that needs to be started at to begin dragging, or -1 if one can start anywhere. -
hitboxes
-
grabbedBox
public final int[] grabbedBox -
ticksExisted
public int ticksExisted -
pos
protected final net.minecraft.core.BlockPos pos
-
-
Constructor Details
-
DragImmersiveInfo
public DragImmersiveInfo(net.minecraft.core.BlockPos pos) -
DragImmersiveInfo
public DragImmersiveInfo(net.minecraft.core.BlockPos pos, int startingHitboxIndex)
-
-
Method Details
-
getAllHitboxes
- Specified by:
getAllHitboxesin interfaceImmersiveInfo- Returns:
- The list of all hitboxes this Immersive uses. This can contain null elements, and can return an immutable list implementation if desired.
-
hasHitboxes
public boolean hasHitboxes()Description copied from interface:ImmersiveInfoWhether this ImmersiveInfo contains valid hitboxes that are ready for use by users in-game.ImmersiveInfo.getAllHitboxes()will not be called if this method returns false for a given tick.- Specified by:
hasHitboxesin interfaceImmersiveInfo- Returns:
- Whether
ImmersiveInfo.getAllHitboxes()can be safely called and contains expected data.
-
getBlockPosition
public net.minecraft.core.BlockPos getBlockPosition()Description copied from interface:ImmersiveInfoGets the block position of the block this ImmersiveInfo represents. This function should always return the same value for an individual ImmersiveInfo instance, and this function may be called after the block at this position no longer matches the Immersive it represents.
For example, if this ImmersiveInfo was used to represent a furnace that was initially placed at x=1, y=2, and z=3, this function should always return the position x=1, y=2, and z=3, even after the furnace is destroyed or replaced by some other block.- Specified by:
getBlockPositionin interfaceImmersiveInfo- Returns:
- The position of the block this ImmersiveInfo represents.
-
setSlotHovered
public void setSlotHovered(int hitboxIndex, int handIndex) Description copied from interface:ImmersiveInfoA notification to mark the given slot as hovered by the given hand index.- Specified by:
setSlotHoveredin interfaceImmersiveInfo- Parameters:
hitboxIndex- The index intoImmersiveInfo.getAllHitboxes()to mark as hovered, or -1 to indicate no slot is hovered by this hand.handIndex- 0 for the primary hand (primary controller in VR or the player hand in non-VR), and 1 for the secondary hand (secondary controller in VR, or nothing in non-VR).
-
getSlotHovered
public int getSlotHovered(int handIndex) - Specified by:
getSlotHoveredin interfaceImmersiveInfo- Parameters:
handIndex- The hand that is checking for a hovered hitbox.- Returns:
- The hitbox the handIndex is hovering, or -1 if it isn't hovering any slot.
-
getTicksExisted
public long getTicksExisted()- Specified by:
getTicksExistedin interfaceImmersiveInfo- Returns:
- The number of ticks this info has existed for.
-