Jump to content

[1.11.2] Custom Mob Spawn Logic Ignored (getCanSpawnHere)


CrowsOfWar

Recommended Posts

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
Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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