// Element V Terrain
ElementCollisionEvents.BLOCK_COLLISION.register((element, terrain, impulse) -> {
if (element instanceof MyCustomPhysicsEntity) {
if (terrain.getBlockState().getBlock().equals(Blocks.BRICKS)) {
System.out.println("Collided with bricks!!");
}
}
});
// Element V Element
ElementCollisionEvents.ELEMENT_COLLISION.register((element1, element2, impulse) -> {
if (element1 instanceof MyCustomPhysicsEntity && element2 instanceof MyCustomPhysicsEntity) {
System.out.println("Element collision!!");
}
});
PhysicsSpaceEvents.INIT.register(space -> {
System.out.println("Initializing physics space!");
});
PhysicsSpaceEvents.STEP.register(space -> {
System.out.println("Stepping physics space!");
});
PhysicsSpaceEvents.ELEMENT_ADDED.register((space, rigidBody) -> {
System.out.println("Added a rigid body!");
});
PhysicsSpaceEvents.ELEMENT_REMOVED.register((space, rigidBody) -> {
System.out.println("Removed a rigid body!");
});