Jump to content

Overriding core method canCreatureTypeSpawn


uParrot

Recommended Posts

Hi all,

 

There is a method in SpawnerAnimals (base MC class) called canCreatureTypeSpawnAtLocation. I need to change it. Or add something to it. Basically, I want to add a new condition for spawning - if it's close to any 'holy entities' that I've added, no normal MC hostile mob may spawn there.

 

I'm not sure where to start looking for how to do this. Before I would have just done it the bad old way, but I'm sure Forge has some way to help out here, some more elegant solution.

 

Is there some kind von hook or something? If not, is there a way I can modify the base class through Forge?

 

http://minecraftforum.co.kr/javadoc/minecraft/net/minecraft/src/SpawnerAnimals.html

 

Thanks in advance, all :D

Link to comment
Share on other sites

Ooh! ;3 that's a good idea.

 

Buuut, how will I be able to tell if it's a naturally spawning (due to low light level) mob and not a mob spawned by a monster spawner or even a mob egg?

 

To shed some light on what I'm trying to achieve, I have some block-style entities, almost like paintings, which act as holy relics. You'll place relics to prevent monsters from naturally spawning within a blahblah radius. I got fed up with making dark temples and things that get filled with unwanted pests, so I modified the base classes to pull it off. But I want to do it properly this time :3

Link to comment
Share on other sites

It would be the easiest solution, but it would also mean that I couldn't have a monster spawner  or anything like that nearby. For example, maybe I want the temple filled with skeletons spawned from a spawner, or from eggs, but without the risk of creepers spawning due to the darkness.

 

A bandaid solution would be to have it only stop creepers from spawning, or perhaps to give the entity a GUI, but that's still quite limiting. My intended use is for adventure maps, but also for survival. Imagine sticking a relic in your house and finally being able to switch off that shiny new redstone lamp. Dark rooms or moody lighting, without the risk of being blown to smithereens before you can say "Honey I'm home!" and hit the lights.

 

EDIT: Another problem with routinely deleting hostiles near the relic: what about mobs that are following you? would be rather silly to run into a room with a relic and suddenly all your pursuers vanish into thin air. ;/  Thanks for the suggestions, though, I hadn't thought of doing it this way before.

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.



×
×
  • Create New...

Important Information

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