Jump to content

Recommended Posts

Posted

Currently, the way to implement a custom spawner is to tick a custom spawning class via WorldTickEvent on the logical server. Minecraft has 5 spawners that are marked as 'special' meaning they extend ISpecialSpawner. These are first passed into an immutable list within MinecraftServer::func_240787_a_ and then stored as a variable within server world to be called when a chunk is ticked.

 

I suggest a new hook that takes in a list of these 5 existing spawners along with a parameter for IServerWorldInfo. This could then be past into a new event which allows the user to add a spawner. As an option, a user might also be able to remove the other 'special' spawners as well to replace with their own. Afterwards, the hook would return an immutable list containing the special spawners. The event should not be cancelable and should not have a result. It would also be fired on the MinecraftForge::EVENT_BUS. This hook would only be called once during the initialization of the logical server as opposed to being called every tick as an alternative.

 

If this seems like a valid event to be implemented, I will get started on creating a PR for 1.16.

Posted
7 hours ago, diesieben07 said:

I am not sure what purpose this event would serve over using WorldTickEvent. The spawners are just called every world tick, unless doMobSpawning is set to false, which is trivial to check. I don't think a new event is needed here.

Ok, just wanted to make sure.

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.