Reforestation
If you're anything like me, when you're playing Minecraft wood is in a constant demand. So, you go and cut down some trees from a forest, right? That means a few less trees for the forest. The trees do drop saplings, but do you really take the time to replant them every single time? How about other people on your server? If you're not careful, serious deforestation can occur, leaving countless animals without a home. Remember, biodiversity shrinks with habitat loss! This problem may seem too large to tackle all by yourself, and you'd be right to think so. That's where Reforestaion comes in! A revolutionary simple plugin that lets mother nature take care of herself!
How is this possible?
Every time a sapling drops from a player or tree, if it can be planted where it lays, it will automatically be placed as a sapling block and will eventually grow into a new tree. No work required on your part!
Is it customizable?
If you're updating to v2.2.0, you have to change your itemID and blockID nodes to itemName and blockName nodes that use Bukkit materialsYes! If you edit the config file located in /plugins/Reforestaion/reforestation.xml, you can set any block and metadata combination. By default the vanilla saplings will only be added, but you can remove or add any blocks you want. This includes things like flowers and mushrooms, but also is extendable to modded saplings (when Bukkit implements a way to access those modded items though IDs or names). You can also set the delay for how often the plugin checks for saplings, which is by default every 200 ticks, or 10 seconds. The tick delay value is measured in ticks, so that means 20 ticks equals 1 second.
In this XML file you can also specify entire worlds that should be disabled as well as specific WorldGuard regions. If you would like to disable Residence regions, make sure the flag "autoplant" (which is enabled by default) is disabled in the region.
Because some users may find it difficult to change values in the config, I'll post what the reforestation.xml file will look like when it's first generated. You can open it with any text editor such as Notepad.
<?xml version="1.0" encoding="UTF-8"?>
<reforestation>
<!-- You can toggle whether the plugin is enabled or not using the command "/reforestation [on|off]" in game, but this controls if it's enabled on startup -->
<autoEnable>true</autoEnable>
<!-- This is how long the plugin waits to see if it can plant saplings. 1 second = 20 ticks -->
<tickDelay>200</tickDelay>
<!-- The following shows how to disable certain worlds
<disabled type="world">
<world>name_of_world_to_disable</world>
</disabled>
-->
<!-- This shows how to disable certain WorldGuard regions
<disabled type="region">
<world>world_that_region_is_in</world>
<region>name_of_region_to_disable</region>
</disabled>
-->
<!-- If you want to disable Residence regions, then make sure the flag "autoplant" is disabled in the region -->
<plant name="Oak">
<itemName>SAPLING</itemName>
</plant>
<plant name="Spruce">
<itemName>SAPLING</itemName>
<itemMeta>1</itemMeta>
</plant>
<plant name="Birch">
<itemName>SAPLING</itemName>
<itemMeta>2</itemMeta>
</plant>
<plant name="Jungle">
<itemName>SAPLING</itemName>
<itemMeta>3</itemMeta>
</plant>
<plant name="Acacia">
<itemName>SAPLING</itemName>
<itemMeta>4</itemMeta>
</plant>
<plant name="Dark Oak">
<itemName>SAPLING</itemName>
<itemMeta>5</itemMeta>
</plant>
<!-- Below is an example of how you would add items that plant different blocks
You can specifiy the blockName and blockMeta nodes to customize which block is placed
By default the block and metadata used are the same as the item's
<plant name="Wheat Seeds">
<itemName>SEEDS</itemName>
<blockName>CROPS</blockName>
</plant>
-->
</reforestation>
Tip: A comment is anything between
<!-- and -->Comments are completely ignored and are only there to help you.
To add more saplings, just create a new plant node, fill out the name attribute, and then add more sub-nodes. The sub-nodes you can add are: itemName, the material of the dropped item; itemMeta, the metadata of the dropped item; blockName, the material of the block that will be placed; and blockMeta, the metadata of the block that will be placed. You do not need to include itemMeta if the metadata is 0 or blockMaterial and blockMeta if those are the same as the original items.
To add a WorldGuard region where auto planting is disabled, simply uncomment out the disabled region node and change the world and region names to your own. You can add as many disabled regions as you'd like. Disabled worlds work the same way, except you don't need the plugin WorldGuard to use them, their type attribute is "world", and they don't use the region sub-node. In order to disable Reforestation in a Residence region, simply make sure the flag "autoplant" is disabled there.
If you're having trouble understanding how to change the config, please post a comment and I'll try to help you.
You can also use /reforestation [on|off] to enable or disable the plugin at any time in game. You need to have the permission node reforestation.toggle in order to use the command. If you want the plugin to be disabled when you start the server, change auto enable to false in the config.yml, or else every time you start the server the plugin will enable planting.
Why do I need this?
It's a fun plugin that adds a nice rounded feel to your server. An example of its realism is that you could start a fire that will actually help the forest grow by causing saplings to fall, just like in the real world.
How did you make such an amazing plugin?
I'm glad you asked! If you're interested in seeing how I accomplished anything, please check out the plugin's source at https://github.com/Jsnman/Reforestation
-
View User Profile
-
Send Message
Posted Oct 5, 2012Great plugin! The only suggestion I have is to be able to set a radius in which a sapling can plant itself, so that my forests will grow more quickly. My server is space-themed with lots of planets and most of the planets have dirt but no natural trees.
-
View User Profile
-
Send Message
Posted Sep 29, 2012@LEOcab
Thats a tough situation. I'm running through a number of possible solutions, but they all seem to fall short. You should try to get a plugin that stops players from dropping items in certain areas. Worldguard might do that, but if it doesn't, Essentials may help. That's all the help I can come up with now. I'll definitely look into it though.
-
View User Profile
-
Send Message
Posted Sep 29, 2012People are using this to grief my spawn area, which is mostly grass. Just drop a sapling and then have the tree destroy anything it touches. Any way to fix this? :/
-
View User Profile
-
Send Message
Posted Sep 18, 2012@Jsn_man
Oh, and one more thing:
The plugin needs a full server restart to reload threadDelay. One simple reload is not enough.
It's not a problem though. I don't think people will change it hourly... =D
HP
-
View User Profile
-
Send Message
Posted Sep 18, 2012@Jsn_man
I've tested the new version, it works great.
Here is the updated, commented review:
"
Regular
Pine6:0
6:1
Birch
Jungle6:2
6:3
Sugar Cane
[Does nothing.]338
Red Flower[OK.]Yellow Flower38
[OK.]
Seeds37
[Does nothing.]
295Melon seeds
[Does nothing.]362
Pumpkin Seeds[Does nothing.]
361Nether Wart
[Does nothing.]372
Cactus[GREAT!]
Brown Mushroom81
[OK.]
Red Mushroom39
[OK.]
Carrot40
[Not tested.]
391Potato
[Not tested.]392
"I know it's still not complete, but great and fast work so far! =)
The only thing is, to do something with the sugar cane and seeds, and this will rock! =D
(Also to prepare for carrots, and potatoes.)
Fine work.
HP
-
View User Profile
-
Send Message
Posted Sep 18, 2012@failtolawl
Or they would plant by a customizable chance.
HP
-
View User Profile
-
Send Message
Posted Sep 17, 2012hey great mod, works well! now, if only I could limit the amount of saplings that fall out.
-
View User Profile
-
Send Message
Posted Sep 17, 2012Wow! That was fast! =)
I'll test it today at the next maintenance.
Thanks a lot,
HP
-
View User Profile
-
Send Message
Posted Sep 16, 2012Okay, I've uploaded v1.3.0 which should fix all of those issues except the error you get from trying to place an item. I'm going to mess with it for a little while until I'm happy with the result.
-
View User Profile
-
Send Message
Posted Sep 15, 2012@Jsn_man That's good to hear, you have solutions for these bugs! Besides it's good for both of us, if this plugin works smooth and fine, so it's ok to take the time for some testing. ;) I was trying to provide as much information on the problem as I could, to help you solve these. =) If I could help you anyway in testing, please let me know. I'll use this plugin on my server, so I could give you further feedback, if you'd like!
HP
-
View User Profile
-
Send Message
Posted Sep 15, 2012@HPoltergeist: Thanks for the very in-depth review, I'll try to answer all of your questions. The reason your server crashes when you add certain types of plants is that you add their item IDs which the server can't plant. I'll take a look at getting this fixed. Also, I've only hard coded the planting requirements for saplings which is why only grass, dirt, and soil can be used. I'll also look into taking the requirements from the actual blocks themselves. Lastly, I took a look at the code and I realized every time the server starts up the default value is used and saved to the config instead of what is actually there. This is an easy fix. I'll update what I can based on your analysis and hopefully all of those issues will be no longer occurring. Thanks again for taking the time to review my plugin at that level.
-
View User Profile
-
Send Message
Posted Sep 15, 2012Hi!
First of all it's a great plugin, but needs some fixing. Maybe this feedback will be useful to fix some bugs. =)
( CB 1.3.1 - R 2.0 + Pail v0.8 + PailPlus v0.3 + others)
I've tried all plant types, but some will crash the server, some will work partly, and some are OK. (Correct me, if I use the wrong IDs.)
Without reforestation, my server is completly free of errors.
Saplings config with my comments:
"
Regular
Pine6:0
6:1
Birch
Jungle6:2
6:3
Sugar Cane
[CRASHES SERVER!!!]338
Red Flower[OK.]
Yellow Flower38
[OK.]
Seeds37
[CRASHES SERVER!!!]
295Melon seeds
[CRASHES SERVER!!!]362
Pumpkin Seeds[CRASHES SERVER!!!]
361Nether Wart
[Does nothing, may crash.]372
Cactus[OK, POSSIBLE TO PLANT ON GRASS BUT NEVER ON SAND.]
81Brown Mushroom
[Sometimes plants on dirt, almost always on grass, but never on stone.]39
Red Mushroom
[Sometimes plants on dirt, almost always on grass, but never on stone.]40
Carrot
[Not tested.]391
Potato[Not tested.]
392"
Cactus on grass: http://s9.postimage.org/lhtybc0e7/2012_09_16_00_35_52.png =D
Besides, every time it restores it's config to 10000ms, even if i change it. If I set the file read-only, then returns this error in console (obviously it can't write in it...):
"
2012-09-16 01:02:33 [INFO] [Reforestation] Enabling Reforestation v1.2.3
2012-09-16 01:02:33 [SEVERE] [Reforestation] Could not save config to plugins\Reforestation\config.yml
java.io.FileNotFoundException: plugins\Reforestation\config.yml (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at org.bukkit.configuration.file.FileConfiguration.save(FileConfiguration.java:56)
at org.bukkit.plugin.java.JavaPlugin.saveConfig(JavaPlugin.java:129)
at me.jsn_man.Reforestation.Reforestation.onEnable(Reforestation.java:34)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:365)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247)
at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
2012-09-16 01:02:33 [INFO] [Reforestation] Reforestation has detected 8 sapling(s). Thread delay at 10000ms, or 10.0 second(s).
"
A crash message, because of a plant for example:
"
2012-09-16 00:41:11 [SEVERE] java.lang.NullPointerException
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.Entity.D(Entity.java:695)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.Entity.move(Entity.java:647)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.EntityItem.h_(EntityItem.java:61)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.World.entityJoinedWorld(World.java:1239)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:498)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.World.playerJoinedWorld(World.java:1221)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.World.tickEntities(World.java:1119)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:565)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:212)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406)
2012-09-16 00:41:11 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
2012-09-16 00:41:11 [SEVERE] Encountered an unexpected exception NullPointerException
java.lang.NullPointerException
at net.minecraft.server.Entity.D(Entity.java:695)
at net.minecraft.server.Entity.move(Entity.java:647)
at net.minecraft.server.EntityItem.h_(EntityItem.java:61)
at net.minecraft.server.World.entityJoinedWorld(World.java:1239)
at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:498)
at net.minecraft.server.World.playerJoinedWorld(World.java:1221)
at net.minecraft.server.World.tickEntities(World.java:1119)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:565)
at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:212)
at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
2012-09-16 00:41:12 [SEVERE] This crash report has been saved to: <my minecraft dir>\Craftbukkit\.\crash-reports\crash-2012-09-16_00.41.12-server.txt
"
Suggestions, maybe you could add these:
- customizable random timer for autoplanting
- customizable chance for planting
If you need some other info of my server, then please let me know. I'm looking forward to have this plugin fully functional and compatible! =)
Keep up the good work and thanks for reading this little novelle, =P
HPoltergeist
P.S.
Sorry for the long post. =/
But, here's a cake for you! =3
http://s10.postimage.org/f7ugiwyfd/2012_09_16_01_55_15.png
-
View User Profile
-
Send Message
Posted Sep 9, 2012Is there any way that you could add in the future random tree death and sapling death that way saplings don't crowd out everything when a tree is cut down and forests will naturally change over time. Or is this too complicated/ something another mod would do? http://www.minecraftforum.net/topic/1165046-v125-nature-overhaul-r18daf/
-
View User Profile
-
Send Message
Posted Sep 5, 2012@Jsn_man
So dont bother downloading 1.2.2 in the meantime?
I'l try again tommorow :) best of luck
-
View User Profile
-
Send Message
Posted Sep 5, 2012I'm terribly sorry that v1.2.2 wasn't working! It turns out I made the requirements too strict for the ItemStacks to actually go though. Won't happen again! With the release of v1.2.3 this is fixed, as well as the planting being a bit less intrusive.
-
View User Profile
-
Send Message
Posted Sep 4, 2012@Jsn_man
It now is not planting them at all. :S Default time is set to 10 seconds, (10000ms) yet it is not replanting sapling that fall from trees/leaves or that I drop.
-
View User Profile
-
Send Message
Posted Sep 3, 2012@Jsn_man
Thank you for your quick fixes!
-
View User Profile
-
Send Message
Posted Sep 3, 2012I've just uploaded v1.2.2 which should hopefully fix the bug where saplings planted themselves even if they were picked up by a player. It should be approved within a few hours. Tell me if this worked for you. I'm also thinking about adding the option that Kiak mentioned.
-
View User Profile
-
Send Message
Posted Sep 3, 2012can you make it only decide to replant at the point where the leaves block breaks?
that would solve all problems because it would never be double checking it...?
Good luck working out a best solution
-
View User Profile
-
Send Message
Posted Sep 2, 2012@Jsn_man
Hokay, so small bug. I set my delay to 20000, plenty of time to pick up sapling before it replants. So I pick up the saplings, they are in my inventory. Then it auto-plants it anyways. I still picked it up, but it is still planting the sapling as if I did not pick it up.
Picking up the sapling does not stop it from replanting.