Started by
withermasterbmods
on
Topic category: Help with Minecraft modding (Java Edition)
How do i make a block that very slowly damages player unless they have an item in their inventory?
Topic category: Help with Minecraft modding (Java Edition)
How do i make a block that very slowly damages player unless they have an item in their inventory?
If the block's collision box is smaller than a regular block, (like honey or sweet berries), you can just have it trigger a damage procedure when the player collides inside the block. If it's a solid block, you can make a procedure that triggers on update tick, and runs an entity iterator centered on the block's position, (x + 0.5, y + 0.5, z + 0.5), with a 1.1 block radius. (Thus targeting anything touching the block.)
Then just check if the target entity/entity iterator, (depending on your approach), has the desired item in their inventory. I'm pretty sure there's a function block to do this, but if there isn't, you should be able to use an itemstack iterator to check each inventory slot individually.