Posted November 17, 201212 yr 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
November 17, 201212 yr Couldn't you use EntityJoinWorld event, check if an instance of a hostile mob is spawning and if it's in range of a 'holy entity', if so then cancel the event?
November 17, 201212 yr Author 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
November 17, 201212 yr Couldn't you just make the relic check for hostile mobs around it every second or so? That seems like the easiest way to go.
November 18, 201212 yr Author 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.
November 19, 201212 yr See my answer over in the ASM thread. It will accomplish what you want. http://www.minecraftforge.net/forum/index.php/topic,3402.msg22537.html#msg22537
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.