Jump to content

Spawner control


Recommended Posts

First of all I'm a bloody noob. My java experience is about 8 hours so speak slowly please. :-)


I was able to install eclipse and the forge environment and even make some really basic mods like changing terrain generation or modify the options menu. All of these changes were event based. So when ever the terrain generator checks if it can spawn a village at a certain location, I hooked in, replaced the original function and told him "Sorry dude, wrong dimension" or "Sure, let super handle it". I can work with that.


Now I want to have more control over the spawn algorithm especially the spawn algorithm from spawner. I know spawner call the function updateSpawner() regularly. The functions are in net.minecraft.tileentity.MobSpawnerBaseLogic but I cannot find an event to replace the original function with my function. I know some of the variables are public so I might be able to modify them like the spawning delay/range and so on. But what I want to do is to make mobs ignore the light level. The light level is checked in net.minecraft.entity.EntityLiving and I might be able to hook into into this class but this will never tell me if the mob was spawned from a spawner or regular. How do I do that instead?


I know there is a possibility to change the core classes. So when I add a flag to the entity spawned by a spawner I would be able check if it cares about light or not. But most of the information on access transformers are rather outdated or incomplete. I have a basic understanding how this works but I don't know if it is really necessary as it might cause problems with other mods.


Any hint is greatly appreciated.

Link to comment
Share on other sites

I want a mob spawner to spawn mobs even if it the room is lit up. After posting this I looked into the docs again. There is a new (to me) event net.minecraftforge.event.entity.living.LivingSpawnEvent.SpecialSpawn. Can I use that to override the light check?


// Edit: It seems the special spawn event is called after the light check so it might not be helpful in my case. :-(

Link to comment
Share on other sites

This is an idea for hardcore player for making the game a lot harder. Building a mob farm is not that easy with a bunch of zombies around trying to eat your brain. I could use a custon block, but I would have to reimplent the complete dungeon spawn process including all needed world generation and spawning process. That seems a bit excessive when I only need to change a line in the original code.

Link to comment
Share on other sites

That would be awesome. And it would be useful for other nice features like stop spawning where there is no solid block to prevent water traps or fall traps. I already know a ton of uses for this. :-)


Can I monitor the progress somewhere like a feature request page or something? (Sorry, I'm new to this.)


So it should be something like the CheckSpawn function but for special mobs to change to conditions of spawning from mob spawner.

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.

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.

  • Create New...

Important Information

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