Jump to content

[1.15.2] How to create a zombie spawner?


foul_owl

Recommended Posts

Right now I am happily placing blocks with "setBlockState" but I ran into a small issue.

 

I would like to be able to place a monster spawner.

 

I have tried "Blocks.SPAWNER.getDefaultState()" but I don't have any control over what type of spawner.

 

How exactly would I place a spawner of a specific type?

Link to comment
Share on other sites

Have you tried looking through the code, starting with SpawnerBlock?

 

Best guess, having not tried this myself, is that the TileEntity for the SpawnerBlock controls the spawning, so I'd start looking there. :)

I just opened SpawnerBlock, and the createTileEntity() method returns a new MobSpawnerTileEntity, so following into that class, I see there's a private AbstractSpawner field called spawnerLogic, so I'd probably go there next (as well as scan the rest of the code in the tile entity just to see if there's anything useful). . .you see what I mean. :)

 

Find something that looks promising, attempt to implement it, then come back here if it doesn't work, post a link to your code (having a github repo is the best way to share your code, and you likely will get more help having one, since it's easier to search through/clone/debug/etc) and also your debug.log (posting as a github gist is probably the best way, again with a link to here).

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