#Testing volume for specific block types

1 messages · Page 1 of 1 (latest)

shadow juniper
#

Is there a better way of testing a volume of blocks for a specific block type other than testing every position?
The use case is making an "ore detector" item that beeps if the player is near an ore.
My current idea is to take advantage of how ore veins generate in blobs to space out a grid of somewhat-optimally arranged markers to reduce the number of tests needed.

pulsar eagleBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1746440927:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

shadow juniper
#

another method i thought of is to copy the region into a dummy dimension and use a fill command there to test

wise iris
#

how is ore detector supposed to work?

#

you just walk, and then if there is an ore near you it beeps?

shadow juniper
#

something like that yeah. like the metal detector from terraria (which tells you the most valuable ore in the area, but not where it is)

wise iris
#

how big is the radius you plan on checking tho

shadow juniper
#

i had a datapack which had an item similar to this, but it had to be used manually. as having a fill command work in the area to replace every ore with a command block was a little too laggy

#

15x15x15 is the current size im after, but if a larger size is possible that would work better.

#

like 25x25x25 maybe

wise iris
shadow juniper
#

i dont recall how laggy it was exactly, but it wasnt a single fill command. each ore had its own fill command. that specific item would make the ores "glow", so every ore in the area was replaced with a command block, and then the command block would set itself back to the appropriate ore type.

#

in retrospect, i doubt the item would have caused noticeable lag if it was allowed to run every tick, but the datapack had a large amount of other custom items/mobs/etc and so i opted for a manually-activated item to reduce passive lag.

wise iris
#

and instead of running every tick, running every second would also improve performance

shadow juniper
#

would it still be possible to have it work with every ore type?

wise iris
#

yup

#

you can create your own block type in datapack

shadow juniper
#

i know block tags are a thing, and i do use them. but if im replacing every ore of every type to the same dummy block, how would i convert the dummy blocks back to the correct ore type?

#

unless you are suggesting there is a way to fill the blocks without replacing them

wise iris
shadow juniper
#

copying to a different dimension isnt super laggy? i know i asked a question in this server a while ago about it and someone said it would be really laggy to keep a dummy dimension loaded (had to do with copying redstone contraptions to a dummy dimension and pretend the contraption is inside a custom item)

wise iris
#

if its not forceloaded it should be fine iirc

shadow juniper
#

forceloading really that laggy huh? ill have to give the interdimensional cloning a try

wise iris
#

nice, tell me how it goes

shadow juniper
# wise iris if its not forceloaded it should be fine iirc

this is a shame though. the idea i had a while ago was to give the player a way of "miniaturizing" small redstone contraptions and turn them into an item. you could have a tnt cannon but hand-held, or a firecharge gun. the only reason i didnt continue the project was i found there to be no way of combining multiple item models together in the way that i needed. i wanted the item to look like the contraption

#

like it would scan every block of the build and modify the item model to match

#

but yeah, we will see how this new testing works

jaunty arrow
#

Scanning every block doesn't have to be super laggy if done well. That's what I do in Dragonkind Evolved, but I break it up into smaller regions and only check each block in that region if the central block is an ore. This does make it so some ores squeak by if you're standing still, but they fill in as you move

pulsar eagleBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.

pulsar eagleBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.