Class TestDuckRigidBody

java.lang.Object
net.xmx.velthoric.core.body.VxBody
net.timtaran.interactivemc.body.duck.TestDuckRigidBody
All Implemented Interfaces:
IGrabbable

public class TestDuckRigidBody extends net.xmx.velthoric.core.body.VxBody implements IGrabbable
Test body for debugging grab and trigger interactions.
  • Field Summary

    Fields inherited from class net.xmx.velthoric.core.body.VxBody

    dataStore, physicsId, physicsWorld, synchronizedData, type
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestDuckRigidBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id)
    Client-side constructor.
    TestDuckRigidBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld physicsWorld, UUID id)
    Server-side constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canRelease(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart)
    Method called before the body is released.
    static int
    createJoltBody(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.core.body.factory.VxRigidBodyFactory factory)
     
    @Nullable GrabPoint
    getGrabPoint(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, com.github.stephengold.joltjni.readonly.RVec3Arg intersectionPoint, com.github.stephengold.joltjni.readonly.QuatArg rotationDifference)
    Defines where on the body a grabber attaches.
    @Nullable GrabPoint
    getRemoteGrabPoint(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, com.github.stephengold.joltjni.readonly.RVec3Arg intersectionPoint)
    Gets the grab point position in the local space.
    void
    onGrab(net.minecraft.world.entity.player.Player player, net.xmx.velthoric.core.body.VxBody grabberBody, PlayerBodyPart bodyPart, boolean isAttached)
    Method called when the body is grabbed.
    void
    onGrabClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached)
    Method called when the client receives successful grab result from the server.
    boolean
    onPull(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart)
    Method called when the body is being pulled.
    void
    onRelease(net.minecraft.world.entity.player.Player player, net.xmx.velthoric.core.body.VxBody grabberBody, PlayerBodyPart bodyPart, boolean isAttached)
    Method called when the body is released.
    void
    onReleaseClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached)
    Method called when the client receives unsuccessful grab result from the server.
    void
    onTriggerStateUpdate(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, TriggerState triggerState)
    Method called when body is being interacted.

    Methods inherited from class net.xmx.velthoric.core.body.VxBody

    calculateRenderState, get, getActivation, getBodyId, getCullingAABB, getDataStore, getDataStoreIndex, getMotionType, getNetworkId, getPhysicsId, getPhysicsWorld, getShape, getSynchronizedData, getTransform, getTransform, getType, getTypeId, isInitialized, onBodyAdded, onBodyAdded, onBodyRemoved, onBodyRemoved, onClientTick, onPhysicsTick, onPrePhysicsTick, onServerTick, onSyncedDataUpdated, onSyncedDataUpdated, setActivation, setBodyId, setClientData, setDataStoreIndex, setMotionType, setNetworkId, setServerData, setShape, writeDirtySyncData, writeInitialSyncData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestDuckRigidBody

      public TestDuckRigidBody(net.xmx.velthoric.core.body.VxBodyType type, net.xmx.velthoric.core.physics.world.VxPhysicsWorld physicsWorld, UUID id)
      Server-side constructor.
      Parameters:
      type - the body type
      physicsWorld - the physics world
      id - the unique identifier for this body
    • TestDuckRigidBody

      @Environment(CLIENT) public TestDuckRigidBody(net.xmx.velthoric.core.body.VxBodyType type, UUID id)
      Client-side constructor.
      Parameters:
      type - the body type
      id - the unique identifier for this body
  • Method Details

    • createJoltBody

      public static int createJoltBody(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.core.body.factory.VxRigidBodyFactory factory)
    • getGrabPoint

      @Nullable public @Nullable GrabPoint getGrabPoint(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, com.github.stephengold.joltjni.readonly.RVec3Arg intersectionPoint, com.github.stephengold.joltjni.readonly.QuatArg rotationDifference)
      Description copied from interface: IGrabbable
      Defines where on the body a grabber attaches.
      Specified by:
      getGrabPoint in interface IGrabbable
      Parameters:
      player - the player interacting with the body
      bodyPart - player body part interacting with the body
      intersectionPoint - the intersection point between the grabber and the body, relative to the body position (not center of mass). Implementations may use this to determine the closest valid grab point. If the grab point is arbitrary, set GrabPoint position to intersectionPoint.
      rotationDifference - the rotation difference between the grabber and the body. If body shouldn't move, set GrabPoint rotation to rotationDifference.
      Returns:
      GrabPoint, or null to prevent grabbing.
    • getRemoteGrabPoint

      @Nullable public @Nullable GrabPoint getRemoteGrabPoint(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, com.github.stephengold.joltjni.readonly.RVec3Arg intersectionPoint)
      Description copied from interface: IGrabbable
      Gets the grab point position in the local space.

      Defines where a grabber attaches to the body during a remote grab.

      Specified by:
      getRemoteGrabPoint in interface IGrabbable
      Parameters:
      intersectionPoint - the intersection point between the grabber and the body.
      Returns:
      the local position of the grab point, or null to prevent grabbing.
      See Also:
    • onTriggerStateUpdate

      public void onTriggerStateUpdate(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, TriggerState triggerState)
      Description copied from interface: IGrabbable
      Method called when body is being interacted.
      Specified by:
      onTriggerStateUpdate in interface IGrabbable
      Parameters:
      player - the player interacting with the body
      bodyPart - player body part interacting with the body
      triggerState - the trigger state of body part
    • onGrab

      public void onGrab(net.minecraft.world.entity.player.Player player, net.xmx.velthoric.core.body.VxBody grabberBody, PlayerBodyPart bodyPart, boolean isAttached)
      Description copied from interface: IGrabbable
      Method called when the body is grabbed.

      If isAttached is false, the body is marked to pulled.

      Specified by:
      onGrab in interface IGrabbable
      Parameters:
      player - the player grabbing the body
      grabberBody - the body part grabbing this body
      bodyPart - player body part grabbing the body
      isAttached - true if the body is attached to the player body part, false otherwise
    • onPull

      public boolean onPull(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart)
      Description copied from interface: IGrabbable
      Method called when the body is being pulled.
      Specified by:
      onPull in interface IGrabbable
      Parameters:
      player - the player pulling the body
      bodyPart - player body part pulling the body
      Returns:
      true to allow pulling body, false otherwise
    • onRelease

      public void onRelease(net.minecraft.world.entity.player.Player player, net.xmx.velthoric.core.body.VxBody grabberBody, PlayerBodyPart bodyPart, boolean isAttached)
      Description copied from interface: IGrabbable
      Method called when the body is released.
      Specified by:
      onRelease in interface IGrabbable
      Parameters:
      player - the player releasing the body
      grabberBody - the body part grabbing this body
      bodyPart - player body part releasing the body
      isAttached - true if the body was attached to the player body part, false otherwise
    • canRelease

      public boolean canRelease(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart)
      Description copied from interface: IGrabbable
      Method called before the body is released.
      Specified by:
      canRelease in interface IGrabbable
      Parameters:
      player - the player releasing the body
      bodyPart - player body part releasing the body
      Returns:
      true to allow releasing body, false otherwise
    • onGrabClient

      public void onGrabClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached)
      Description copied from interface: IGrabbable
      Method called when the client receives successful grab result from the server.

      If isAttached is false, the body is marked to pulled.

      Specified by:
      onGrabClient in interface IGrabbable
      Parameters:
      player - the player grabbing the body
      bodyPart - player body part grabbing the body
      isAttached - true if the body is attached, false if being pulled
    • onReleaseClient

      public void onReleaseClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached)
      Description copied from interface: IGrabbable
      Method called when the client receives unsuccessful grab result from the server.
      Specified by:
      onReleaseClient in interface IGrabbable
      Parameters:
      player - the player that was grabbing the body
      bodyPart - player body part that was grabbing the body
      isAttached - true if the body was attached, false if it was being pulled