Blocks

Yes reducing the bounds of the grid will stop it from trying to load/generate chunks outside of the grid boundaries.

That’s very good as this makes no sense, hence the warning :slight_smile:
If you directly add blocks to a chunk, it will log a warning when the chunk doesn’t contain the block location. You should use ChunkManager#addBlock instead. This will locate the correct chunk for you and you can just use block ‘world’ locations. So no need to calculate stuff on your own. When you use Chunk#addBlock you need to provide local block coordinates. If your chunk is 32x32x32, it will log a warning when you try to add a block to for example (0, 41, 16).
Normally you shouldn’t even worry about chunk management, that’s what the ChunkManager does. You should use ChunkManager#addBlock and ChunkManager#removeBlock to place and remove blocks.

Yes, only the ChunkRepository may return null chunks. I figured it makes no sense that the result of a chunk generation would be null.
The pager will request only chunks that are in the bounds of the grid. The generation logic should either return full chunks (under ground chunks), empty chunks (air) or half filled chunks (terrain crust). If you want an empty chunk, just return Chunk.createAt(new Vec3i(0,0,0)).

Mmm, this might be a bug in Blocks/Minie. As @jayfella mentioned, this is thrown when trying to a create a collisionshape mesh that is empty.

edit: I was indeed able to reproduce it. I can (and should) add an additional check to skip creating a physics object for empty chunks. if (... || chunk.isEmpty() || ....)

@sgold stacktrace:

Current thread (0x00007f7f451f5000):  JavaThread "jME3 Main" [_thread_in_native, id=91399, stack(0x000070000d0d1000,0x000070000d1d1000)]

Stack: [0x000070000d0d1000,0x000070000d1d1000],  sp=0x000070000d1d05a0,  free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libbulletjme.dylib+0x74fea]  btQuantizedBvh::buildTree(int, int)+0xca
C  [libbulletjme.dylib+0x11742f]  btOptimizedBvh::build(btStridingMeshInterface*, bool, btVector3 const&, btVector3 const&)+0x59f
C  [libbulletjme.dylib+0x7d10c]  btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface*, bool, bool)+0x7c
C  [libbulletjme.dylib+0x74706]  Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_createShape+0x46
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.createShape(ZZJ)J+0
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.createShape([B)V+30
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.<init>([Lcom/jme3/scene/Mesh;)V+35
j  com.rvandoosselaer.blocks.examples.PhysicsScene.simpleUpdate(F)V+121
j  com.jme3.app.SimpleApplication.update()V+82
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j  com.jme3.system.lwjgl.LwjglDisplay.runLoop()V+104
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+136
j  java.lang.Thread.run()V+11 java.base@11.0.7
v  ~StubRoutines::call_stub
V  [libjvm.dylib+0x399a52]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x21a
V  [libjvm.dylib+0x398e9c]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0xee
V  [libjvm.dylib+0x398f58]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, Thread*)+0x62
V  [libjvm.dylib+0x41cdc9]  thread_entry(JavaThread*, Thread*)+0x78
V  [libjvm.dylib+0x6ec12c]  JavaThread::thread_main_inner()+0x82
V  [libjvm.dylib+0x6ebf76]  JavaThread::run()+0x174
V  [libjvm.dylib+0x6e9e52]  Thread::call_run()+0x68
V  [libjvm.dylib+0x5f18a3]  thread_native_entry(Thread*)+0x139
C  [libsystem_pthread.dylib+0x6109]  _pthread_start+0x94
C  [libsystem_pthread.dylib+0x1b8b]  thread_start+0xf

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.createShape(ZZJ)J+0
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.createShape([B)V+30
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.<init>([Lcom/jme3/scene/Mesh;)V+35
j  com.rvandoosselaer.blocks.examples.PhysicsScene.simpleUpdate(F)V+121
j  com.jme3.app.SimpleApplication.update()V+82
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j  com.jme3.system.lwjgl.LwjglDisplay.runLoop()V+104
j  com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+136
j  java.lang.Thread.run()V+11 java.base@11.0.7
v  ~StubRoutines::call_stub```
1 Like