spawns
Spawns is a plugin for Bukkit and Minecraft that allows you to fully customize the spawning behaviour of mobs on your server.
Features
- tweak the default Minecraft spawns or replace them completely
- set mobs to spawn under conditions they never normally would
- block certain mobs from ever spawning
- cause mobs to spawn with potion effects, equipment, saddles, etc.
- cause mobs to spawn in different variants, like powered creeper, wither skeleton, etc.
- mobs appear in the world in the same way as they do normally, so are compatible with all other plugins
Dive right in here to see how to make config files or keep reading for an overview of Minecraft spawning.
Default spawning
Minecraft spawning works like this:
Every spawn cycle (1 tick or 1/20 second by default for hostile mobs) the game makes a list of all the chunks around each player, up to a radius of seven chunks. Each chunk will only be counted once, even if that chunk is around several players.
Once this list is complete a mob limit is calculated. The limit is higher the more chunks are in the list. If the limit is lower than the current amount of a mob type in the world then the cycle will be cancelled.
If the limit is not yet reached a random block from each chunk in the list will be calculated and this chunk will be used as the centre point for a pack of mobs to spawn around. In order to continue, this block must be water for water mobs (only squid so far) and air for any other type of mob.
If this block is suitable then a maximum of 12 random blocks are chosen from up to 20 blocks away, but always at the same height as the centre block.
Lastly, The individual blocks are checked that they can physically fit the mob, so they need to be air, have air above and an opaque block below. The type of mob is chosen based upon the matching conditions (biome, height, floor block type, etc.) and the final mob is chosen randomly from all mobs that are eligible to spawn there. All other mobs in the pack will be the same type.
Permissions
spawns.can-reload-config, which allows the user to reload the config. Default is Op.
spawns.can-count-mobs, which allows the user to display a summary of mob amounts in a world. Default is Op.
Commands
/reload-spawns, or /rs, which reloads the config without having to reload the server. Any mobs already in the world will be unaffected by any changes in the config.
/count-mobs, or /cm, which displays a list of mob numbers in the world. Add a world name argument to specify a world (optional if run as a player) and / or a mob type argument to choose one type of mob to count.
Update checking
If you like, you can set the plugin to check for any newer versions that get released. To do this add an element to the config.xml file, like this:
<check-for-newer-version/>
When this element is present the plugin will report if it finds a newer version. This only works for release builds so you won't be bothered by any beta or dev builds. To disable this checking simply remove the element.
Note that no update will be downloaded even with this set.
Examples
I would love to get any example config/packs/mobs files you have created to add to the docs, so if you have one you're proud of send it in and I'll add it.
spawns took a lot of work, so if your server is enriched by it please consider sending some love my way!
<a href="https://www.paypal.com/cgi-bin/webscr?return=http://dev.bukkit.org/server-mods/mobs/&cn=Add special instructions to the addon author(s)&business=apodlesna@gmail.com&bn=PP-DonationsBF:btndonateCCLG.gif%3ANonHosted&cancelreturn=http%3A%2F%2Fdev.bukkit.org%2Fserver-mods%2Fmobs%2F&lc=US&itemname=spawns+%28from+Bukkit.org%29&cmd=donations&rm=1&noshipping=1¤cycode=USD"><img class="aligncenter" alt="donate" src="https://www.paypalobjects.com/enUS/i/btn/btndonateLG.gif" /></a>
If you're penniless or like spawns but not that much I'm also partial to TF2 items. Send any you don't want my way! STEAM id: coldntired
If you don't know what TF2 is, then start playing! It's free and fun!
For other projects, links, help, etc. please visit the main website.
You can also follow sylian.eu on Twitter for updates.
-
View User Profile
-
Send Message
Posted May 16, 2014@shaythegoon No errors in the log?
-
View User Profile
-
Send Message
Posted May 16, 2014@coldandtired
Thanks for the reply we will try it out some more.
-
View User Profile
-
Send Message
Posted May 16, 2014Hey Cold, just whilst your here...
Inside tags still don't seem to be working. We removed the sky-light tags and kept the Inside tags but nothing seems to be working.
Thanks
Shaythegoon
-
View User Profile
-
Send Message
Posted May 16, 2014@johndcastro The first two beta versions (1.7.9 b1/b2, and 1.7.2 b6) tracked the mobs in (spawning) and out (dieing) but this wasn't working because as you say mobs can disappear by other means.
From 1.7.9 b3/1.7.2 b7 I changed that.
Now, every mob that spawns gets added to the database, and when it dies it gets removed. When you use the world-has-spawned condition with no attributes or with only the mob-type attribute that database isn't used and the condition counts the mobs in the world and filters them by type. Then checks the condition using this number and the value you put in the config.
If you have a world-has-spawned condition with mob-id, pack-id, hub-id, or timer-id the database needs to be queried (as Minecraft doesn't store those values usefully). First the same filtering as above is done (if mob-type is used) and then the condition finds all the mobs in the database that are both in the world at the time and match the id attributes.
This does however have a couple of small, unavoidable problems. One is that when you first install the new version the database is empty, so the advanced world-has-spawned condition will only be able to query mobs that have spawned since the plugin was installed. The simple version will still work properly though, and updates to the plugin won't delete all the mobs in the database so this is only when moving to the first version with the DB.
Second is that mobs that get removed without dieing will hang around in the database. They won't have an effect on the world-has-spawned condition though as only mobs currently in the world are counted. I added a spawned_at time column so you can remove all old entries (or in fact any mobs you choose) once in a while. I don't play MC so I'm not sure how long a mob can live but I would think any mobs that are a week old and still in the database are likely safe to remove.
I can confirm that using per-player="yes" will count all the players in the world and then divide the normal value the condition would use by this number. If you like I can add the option to divide by the number of players selected by the timer.
I realize that properties use per-player="x" and conditions use per-player="yes/no" so I will likely be changing one of them so they match in the near future.
Hope that helps :)
-
View User Profile
-
Send Message
Posted May 16, 2014Hello @coldandtired, again great plugin. I have a few questions for you:
1. Can you confirm that you are not actively counting mobs in the spawns_mobs database and you are looking for them to be killed or something correct? The issue I think we are seeing is if mobs are removed some other way than despawning (i.e. we use towny that blocks mobs in towns or if a admin uses butcher) they do not appear to be removed from the database so in using the world-has-spawned metric we are getting inconsistent results
2. Can you validate that if using the timer-has-spawned per-player flag the per-player flag is based on the number of players in the world and not the players selected by the timer. I.e. if we do <select-players>30..40</select-players> and we wanted to limit the mobs spawned based on the players selected but not the total players in the world this will not work correct?
-
View User Profile
-
Send Message
Posted May 15, 2014I do Python, Lua, JavaScript, CSS and HTML5, but Java just scared when I got to the Bukkit stuff. xD
Anyways
Good luck
-
View User Profile
-
Send Message
Posted May 15, 2014@shaythegoon There's already a time condition called world-time, which deals with the ingame ticks.
The other conditions will be coming pretty quickly as I've already written most of them in Mobs :) I'm just deciding which syntax to use for the custom actions and then I can add them.
I have a Windows Phone app in the final stages which I want to push out before switching back to *shudder* Java but it should be done by the end of the weekend.
-
View User Profile
-
Send Message
Posted May 15, 2014@coldandtired
Oh, okay. Thanks :D
Did you read my suggestions. Sorry I'm being pushy. I just keep coming up with ideas and I write them right here. Could we see a condition of time of day as well (In minecraft ticks) so we could aim our mobs at time of day?
Thanks
Shaythegoon
-
View User Profile
-
Send Message
Posted May 15, 2014@shaythegoon This condition is badly formed, which might be causing the whole group to fail to be parsed - <sky-light>1-15</sky-light>
It should be <sky-light>1..15</sky-light>
Also, this will cancel out the inside condition as inside/outside are just convenience aliases for sky-light levels.
-
View User Profile
-
Send Message
Posted May 15, 2014Not sure if you wanted the full document (its nearly 400 lines long) so I sent you just one of the mobs this isn't working for (all of them aren't working.)
http://pastie.org/9178982 http://pastie.org/9178988
Its in the Mobs file. Both these mobs are spawning inside and outside...
Thanks
-
View User Profile
-
Send Message
Posted May 15, 2014@shaythegoon Can you paste your config where you're seeing this happen?
-
View User Profile
-
Send Message
Posted May 15, 2014Hmmm
Bug-report!
The <inside>true</inside> <inside>false</inside> conditions don't seem to be working. I get mobs spawning in a room, even though the mobs are set to only spawn outside.
Thanks
Shaythegoon
-
View User Profile
-
Send Message
Posted May 14, 2014Hey,
Finally a question that isn't to do with Configs!!! Is it possible that we could get conditions to do with players added in a timer/hub centered around a player. This way we can stop the Plugin from causing so much lag on the Server.
Potential Conditions:
Could we also have something that checks regions that we have created in WorldGuard, such as a Condition that the mob will only spawn in the correct Regions, using the WorldGuard region name would probably be the best way to do this...
Thanks so much for reading again
Shaythegoon
ps: Hey Looks!
-
View User Profile
-
Send Message
Posted May 13, 2014@shaythegoon Mobs can do it, but the next content release of Spawns will include this feature (stolen mostly from Mobs :) )
-
View User Profile
-
Send Message
Posted May 13, 2014How would I create an area where mobs aren't allowed to spawn, is there a plugin for this. I have cities, which I don't want mobs to spawn in for obvious reasons, but I'm happy for them to spawn in other areas. Your expertise would be greatly appreciated!
Shaythegoon
Wow, WorldGuard.. duh
-
View User Profile
-
Send Message
Posted May 12, 2014@shaythegoon Your conditions are stopping the timer before it can start. 0.. means 0 or more, i.e. any number. Try changing it to this:
-
View User Profile
-
Send Message
Posted May 12, 2014Hey,
Downloaded 1.7.9b3 bur am still unable to get mobs to respawn after I kill them once... Is it something I have done wrong in my xml's?
ServerWorld.xml: http://pastie.org/9168948 Mobs.xml: http://pastie.org/9168952
Shaythegoon
-
View User Profile
-
Send Message
Posted May 12, 2014@AnorZaken Yes, it is the UUID I'm using as an index. :) I've never even bothered with the other unique id.
Dealing with mobs in Minecraft is a horrible experience as there are so many ways they can disappear. Previous versions of Mobs/Spawns had the list pruned automatically but there were still always problems so this time I've decided to let the admin decide how to handle it. Same with world ids. I'm leaving it up to the admin to manage the database entires when he/she decides to alter the world significantly. I might add a clear command or something to remove all the mobs (or all of x type) though, but this can easily be done with a simple SQL statement that shouldn't be beyond anyone capable of running a server :)
I don't subscribe to to the chunk events any more as they didn't seem to be working as expected and once the mob is in the db it doesn't really matter (other than some space) whether it's in the world or not.
I used to have a world column but it wasn't much use as the count condition grabs all mobs with ids found in the world at the time, so it should never grab any mobs from another world. I included the spawn_location column (with world name) as I might use it in a condition later on (if mob spawned above x=10...)
The next content update will have the feature to perform different actions based on whether the mob is in the db (and what info is there) or if it's vanilla. For example, it will be possible to switch a vanilla pig for a pig from the config when it dies so you can be sure that the loot will match whatever you have in your config, regardless of how it spawned.
-
View User Profile
-
Send Message
Posted May 11, 2014@coldandtired
Had a look at your wiki, noticed it said:
"Each record in the database contains these fields:
I just wanted to confirm, that what you actually mean is "unique UUID" and not "unique id". Why? Because the "unique id" of the mob will change if the mob is saved during a chunkunload and then restored in a chunkload. So if you spawn a mob (that doesn't get removed), walk away so the chunk unloads (mob gets saved to nbt), and walk back (mob gets loaded from nbt), it will not have the same "unique id" anymore! UUID on the other hand is saved in the nbt-data!
It would be even worse if as you suggested you want to give mobs unique drops (or stuff like that) based on a "unique id" entry in your database, because in theory you could end up with a mismatch:
Note: This is not very likely to happen while the server is still running, but it is VERY likely to happen if the unload was due to a server restart/shutdown. Basically if you are not storing UUID then everything in the database is outdated and useless after a server restart.
You can see exactly what gets saved in the Craftbukkit code here.
(The save method is "public void e(NBTTagCompound nbttagcompound)")
(The load method is right below it: "public void f(NBTTagCompound nbttagcompound)")
Also small suggestion to your database cleaning idea: You are listening to chunkload/unload right - so add a boolean to your database: isSaved.
That way when you prune the database you can skip all entries with isSaved == true, because if I'm not mistaken these can not have become invalid.
Maybe you already have this but you should separate the mob entries based on world.
A. You don't have to check all entries if Spawns is configured to run in more than 1 world.
B. If a world gets removed from the server just remove all entries for that world.
(C. Store world UUID - not world name! Because when creating new worlds it is common to use the same name many many times during repetitive world creation until a satisfactory world has been generated. This could lead to the database accumulating a bit of garbage that would never be cleared. Also world name changing might potentially be supported in the future just like player name changes will be soon. So it's good practice.)
Edit: Basically the intended use for "unique id" is for fast equality checks while the server is running, it is used in CraftEntity.equals(...) - but it is used for comparing entity references, and so the logic is sound so long as no plugin is storing a reference to an entity, and they shouldn't because that would be a bug resulting in a memory leak when that entity gets removed from the world. Thus using the "unique id" to do anything is a bug unless you know 100% that the entity-reference you acquired it from is still inside the world.
(In practice it is quite safe as long as the server isn't restarted, but in theory I would still classify it as a bug.)
-
View User Profile
-
Send Message
Posted May 11, 2014Okay, initial testing seems to be holding up so I've released it.
1.7.2 b7/1.7.9 b3 (downloads on the wiki as approval seems to be slow at the moment) now use a database and should fix all the count problems from the last version.
http://wiki.sylian.eu/spawns/world-has-spawned had to change slightly so the page is updated.
http://wiki.sylian.eu/spawns/tracked-mobs now describes the database.
Last big change is that end-if is now checked before any mob spawns (previously it was only checked after each mob). This means you can do this
instead of having specific start and end conditions.