Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

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 by Luis_ST

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.