#Trying to detect the blockstates of blocks in a cube (1.21.1)

13 messages · Page 1 of 1 (latest)

misty knot
#

So im trying to make a pickaxe that tells you when there is ore near the block you have mined. The 2 classes above are my current attempts to make this work (and yes i put the event in the oninitialize) but i cant find a way to make it check for the blockstates of each block in the position.

Any help would be appreciated!

#

Trying to detect the blockstates of blocks in a cube (1.21.1)

little patio
#

what's the issue? if you have a block pos and a world, it's possible to "traverse" a cube from one starting pos

#

i'm pretty sure there's methods to get blocks in each direction but you'll have to come up with an algorithm to take into account a cube

#

(very general statement btw)

misty knot
#

i have something to grab the blocks, but the thing is, when i try to make like an if statement to only activate if the blocks are like, ores. It doesnt work bc im grabbing the blockpos and cant find a way to select only certain blocks with that, but when i try to grab the blockstates, i cant find a way to grab their pos and their states

little patio
#

blockpos can be calculated

misty knot
#

how?

little patio
#

blockpos is x, y, z position of a block on the world

sacred ermine
#

You can prob just check if it's an instance of oreblock

#

Or you make a list of blocks and check if that list contains your block