Jump to content

Beethoven92

Members
  • Posts

    687
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Beethoven92

  1. Nevermind, i just made some tests, you can just override getCollisionShape without all that onEntityCollision stuff(even if it somehow worked). Still we are at the starting point again, by returning the full block collision shape in case your condition is not verified, the block pushes you back, and the only way i managed to get that working is still to return a voxel shape which is slightly smaller than the full cube as i showed earlier..why that works? i honestly still have to figure it out ๐Ÿค”
  2. And thats why you need to override getShape and leave getCollisionShape as it is
  3. I just stick something together trying to solve the problem you had, so my block just extends Block and overrides onEntityCollision and getShape, nothing more
  4. That's what i was thinking, but after testing with multiple blocks it appears that with my code if i am inside one block (and so its voxel shape its null), all the other blocks also have null voxel shapes ๐Ÿค”
  5. So...lets do it again. In your package explorer on the left you have all your projects folders right? Select the one you want to work on and right click it. Then select Run As and Run Configurations. In the window that appears you should see in the box on the left various voices. You should see "Java Application". Inside it there is a runClient voice, left click on that. Then on the right side of the window, in the box with the 'Project' label you have to select the mod project you want to run (use browse button, it should let you see all the project you currently have in your workspace). When you have your project selected click the Run button below. If that doesn't work i swear i do not know what is wrong, as i am doing the same process without any issue
  6. There are some "#missing" textures in your model file
  7. Specify what isn't working, is it loading the wrong project or not running the project at all?
  8. Then just select the project you want to run in the box above (click browse to see all existing projects and select one)...also the project needs to be run with the runClient configuration if you want to start a client instance of minecraft
  9. On the bottom-right of the window, just click the "Run" button
  10. Of course. Right click on the main folder of the project you want to run, then Run As ---> Run Configurations. Inside the window that shows up you can select which of your current workspace projects you want to run
  11. Yes, they will, because i return the selected voxel shape (null or "full" block) from the getShape method
  12. Of course you have to represent your item in code. You need to register it in the forge registries so the game knows it exists
  13. If you want to change the vanilla item behaviour you will need to override the vanilla bow, creating your custom bow and registering it in place of the vanilla one
  14. 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 voxel shape, which then needs 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
  15. ๐Ÿ˜† 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
  16. Well, since you are trying to make the block uncollidable under your conditions, you should check for that condition inside this method (eg check if the player is holding a special item when colliding with your block) and take the appropriate measure.
  17. GlassBlock doesn't override onEntityCollision, but it is inheriting it from the Block class, so you can specify your own version of this method in your custom block, even if the original method is doing nothing.
  18. What about overriding the onEntityCollision method?
  19. Well, if you specify doesNotBlockMovement in the block properties, instead of returning a VoxelShapes#empty under your conditions,you could instead return the collision shape of the block when the condition is not verified. Basically invert what you were doing here: @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { if(/*some condition*/) { return VoxelShapes.empty(); } return super.getCollisionShape(state, worldIn, pos, context); }
  20. Check Item#addInformation
  21. Oh ok, you are overriding the vanilla block with your custom one in the registry, i missed that, my bad! What Draco18 suggested you should be fine
  22. Show your code please
  23. My guess is that Optifine is not updated to 1.16.2 yet. See if it works without it, or consider switching back to 1.16.1 until they update
  24. Do you want to make the Vanilla block have no collision or your custom block? You cannot modify a vanilla block behaviour by extending the block and overriding a method in your custom block
  25. import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; This is the logger you have to import, not the java.util.logging one. That is if you need to use the Logger of course
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.