• Recently Browsing

    No registered users viewing this page.

  • Posts

    • So...i tried to code that myself and i made it work, but my solution may not be the best or the most elegant one. Turns out that onEntityCollision happens only if the shape of the block is set to be smaller than the full block. So i set two different voxel shapes, a null voxel shape and one that is slightly smaller than the cube, with dimensions: Block.makeCuboidShape(0.1F, 0.1F, 0.1F, 15.9F, 15.9F, 15.9F) which doesn't basically change anything visually but lets the collision event happen (For some reason i am still unable to understand). Inside the event i just check for the condition and select the appropriate volxe shape, which then need to be returned by getShape not getCollisionShape. It works but as i said before this seems to be a slightly "hacky" solution and also present some issues: 1) you will be able to walk on the border of your block when in its solid form 2) any other entity will be able to walk through your block while you are inside the block with your condition being verified 3) being the voxel shapes static and shared between all blocks of the same type, when you make one of them not solid, if other are present they will all become not solid
    • porfavorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
    • I did cancel the collision shape of the block (in the very first try) and I'm sure the condition is satisfied since when I have the item, I can clip into the block (and it covers my screen), but there is a force constantly pushing me out and doesn't allow me to walk through the block. Without that item, the block just acts like normal block.
    • 😆 i guess by removing the entity (your player in this case) bounding box, collision with the ground are not checked anymore, thats why you just sank out of the world. Don't touch the entity bounding box...i was thinking at something like...is there a collision between your block and the player? Is your condition satisfied? ----> get rid of the collision shape of the block , else the block is acting as normal with the collisions and all the rest
    • I tried to remove the bounding box of the player by Entity#setBoundingBox in onEntityCollision and it didn't go well. As soon as I touch the block, my entire game runs at 1 fps and I found myself at the bottom of the world. I have a feeling that I used the set bounding box method wrongly because I just get the bounding box of the entity and use AxisAlignedBB#shrink to get rid of the bounding box.
  • Topics

  • Who's Online (See full list)