Posted May 6, 20223 yr Sorry if this has been asked - I've been searching for a while and couldn't find an answer. Is there a performance-friendly way to grab a block if it exists in a chunk? I would assume I would use a BiomeLoadingEvent to do so? Here's pseudocode based on what I've generally been trying so far: @SubscribeEvent public void ChunkBuilt(BiomeLoadingEvent e) { //Block BLOCK_SPAWNER = GET BLOCK BY TYPE (SPAWNER) // BLOCK POSITION = BLOCK_SPAWNER.BlockPos } Basically, I'm looking to determine if a dungeon spawner has spawned, and identify its world position. Thanks!
May 7, 20223 yr 9 hours ago, NuclearLavaLamp said: I would assume I would use a BiomeLoadingEvent to do so? you can not, since there is no World load at this point what did you try to achieve? Edited May 7, 20223 yr by Luis_ST
May 7, 20223 yr Author Thanks! I'm trying to identify if a monster spawner is placed in the world, and, where it is. I've been playing around with BiomeLoadingEvent with no luck, likely due to, as you said, the world not being loaded yet. Next, I was trying to see if I could monitor for the spawn of the spinning entity inside the spawner, hoping I could get its block position on a SpecialSpawn event. It would have been something like: public void onEntitySpawn(SpecialSpawn e) { Entity Entity_Class = e.getEntity(); if(Entity_Class.getType() == EntityType.SPINNING_SPAWNER_ENTITY) { BlockPos Block_Position = Entity_Class.Entity_Class.blockPosition(); } } What I'm trying to achieve: Find / identify where a monster spawner is if it spawns naturally in the world, like, in a dungeon. I'm not actually sure if this is possible, as I could see obvious performance issues with finding blocks through something like an x,y,z loop. I was hoping there was a built-in way or hack to find spawner blocks as they spawn in the world, but haven't found any code yet that would help.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.