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

Hello, I'm working on a bug in my mod and found a behavior that seems really weird.

My mobs need custom spawning behavior in the world. I'm doing the logic to determine spawning is the getCanSpawnHere method. To my understanding, it returns whether the mob can spawn at the given spot, and if it returns false, then the mob spawn is cancelled.

 

I was debugging some code where my mobs were spawning everywhere, but getCanSpawnHere is supposed to only let them spawn near villages. All of my logic looked correct, but even when the method returns false mobs still spawn. This results in mobs spawning even away from villages. I even explicitly tried putting return false so the mobs theoretically can't spawn. But they still are spawning even when getCanSpawnHere returns false!

 

So how should I properly use getCanSpawnHere? It seems to be not working. Thanks.

 

Code

getCanSpawnHere method

Register entity

Register spawn

All files

 

Thank you!

Edited by CrowsOfWar
Clarify MC version

  • Author

Bumping since this is still a problem.

I'm new here and I didn't see anything about bumping being prohibited, but please let me know if bumping is not allowed on this forum.

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.