Class TestDuckRigidBody
java.lang.Object
net.xmx.velthoric.core.body.VxBody
net.timtaran.interactivemc.body.duck.TestDuckRigidBody
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionTestDuckRigidBody(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 TypeMethodDescriptionbooleancanRelease(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart) Method called before the body is released.static intcreateJoltBody(net.xmx.velthoric.core.body.VxBody body, net.xmx.velthoric.core.body.factory.VxRigidBodyFactory factory) @Nullable GrabPointgetGrabPoint(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 GrabPointgetRemoteGrabPoint(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.voidonGrab(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.voidonGrabClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached) Method called when the client receives successful grab result from the server.booleanonPull(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart) Method called when the body is being pulled.voidonRelease(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.voidonReleaseClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached) Method called when the client receives unsuccessful grab result from the server.voidonTriggerStateUpdate(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
-
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 typephysicsWorld- the physics worldid- the unique identifier for this body
-
TestDuckRigidBody
Client-side constructor.- Parameters:
type- the body typeid- 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:IGrabbableDefines where on the body a grabber attaches.- Specified by:
getGrabPointin interfaceIGrabbable- Parameters:
player- the player interacting with the bodybodyPart- player body part interacting with the bodyintersectionPoint- 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, setGrabPointposition tointersectionPoint.rotationDifference- the rotation difference between the grabber and the body. If body shouldn't move, setGrabPointrotation torotationDifference.- Returns:
GrabPoint, ornullto 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:IGrabbableGets the grab point position in the local space.Defines where a grabber attaches to the body during a remote grab.
- Specified by:
getRemoteGrabPointin interfaceIGrabbable- Parameters:
intersectionPoint- the intersection point between the grabber and the body.- Returns:
- the local position of the grab point, or
nullto prevent grabbing. - See Also:
-
onTriggerStateUpdate
public void onTriggerStateUpdate(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, TriggerState triggerState) Description copied from interface:IGrabbableMethod called when body is being interacted.- Specified by:
onTriggerStateUpdatein interfaceIGrabbable- Parameters:
player- the player interacting with the bodybodyPart- player body part interacting with the bodytriggerState- 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:IGrabbableMethod called when the body is grabbed.If
isAttachedisfalse, the body is marked to pulled.- Specified by:
onGrabin interfaceIGrabbable- Parameters:
player- the player grabbing the bodygrabberBody- the body part grabbing this bodybodyPart- player body part grabbing the bodyisAttached-trueif the body is attached to the player body part,falseotherwise
-
onPull
Description copied from interface:IGrabbableMethod called when the body is being pulled.- Specified by:
onPullin interfaceIGrabbable- Parameters:
player- the player pulling the bodybodyPart- player body part pulling the body- Returns:
trueto allow pulling body,falseotherwise
-
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:IGrabbableMethod called when the body is released.- Specified by:
onReleasein interfaceIGrabbable- Parameters:
player- the player releasing the bodygrabberBody- the body part grabbing this bodybodyPart- player body part releasing the bodyisAttached-trueif the body was attached to the player body part,falseotherwise
-
canRelease
Description copied from interface:IGrabbableMethod called before the body is released.- Specified by:
canReleasein interfaceIGrabbable- Parameters:
player- the player releasing the bodybodyPart- player body part releasing the body- Returns:
trueto allow releasing body,falseotherwise
-
onGrabClient
public void onGrabClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached) Description copied from interface:IGrabbableMethod called when the client receives successful grab result from the server.If
isAttachedisfalse, the body is marked to pulled.- Specified by:
onGrabClientin interfaceIGrabbable- Parameters:
player- the player grabbing the bodybodyPart- player body part grabbing the bodyisAttached-trueif the body is attached,falseif being pulled
-
onReleaseClient
public void onReleaseClient(net.minecraft.world.entity.player.Player player, PlayerBodyPart bodyPart, boolean isAttached) Description copied from interface:IGrabbableMethod called when the client receives unsuccessful grab result from the server.- Specified by:
onReleaseClientin interfaceIGrabbable- Parameters:
player- the player that was grabbing the bodybodyPart- player body part that was grabbing the bodyisAttached-trueif the body was attached,falseif it was being pulled
-