Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] Get ServerWorld from ServerTickEvent


Recommended Posts

So I am trying to invoke a custom siege (rather than a zombie siege). I want this event to be independent of zombie sieges (ruling out cancelling the zombie siege event hook). The following code in ServerWorld#tickCustomSpawners loops through the ISpecialSpawners, one of which is a net.minecraft.village.VillageSiege:

public void tickCustomSpawners(boolean p_241123_1_, boolean p_241123_2_) {
      for(ISpecialSpawner ispecialspawner : this.customSpawners) {
         ispecialspawner.tick(this, p_241123_1_, p_241123_2_);

I've written my own Siege class... almost identical to VillageSiege for now... and I want it to tick on the ServerWorld with siegeObject.tick(serverWorld, bool1, bool2). However, I can't access the ServerWorld of a ServerTickEvent. Is there a static ServerWorld I can access for my purposes? Or is there a better event hook I can use that will offer up the ServerWorld object?

Link to comment
Share on other sites

I may have posted this prematurely... I came across the WorldTickEvent hook through which I can access the ServerWorld. 

I'd still appreciate any feedback from more knowledgeable modders... would my implementation with WorldTickEvent be equivalent according to my specification in my original post?

Otherwise, I hope this is useful reference to anyone experiencing the same problem.

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.