TerrainControl
TerrainControl copied to clipboard
Enable BO3 trees to be generated at different heights
This enable to generate trees at different heights when SpawnHeightOffset and SpawnHeightVariance in BO3.
Nice idea, but I think the implementation could be better. You now have lots of blocks like this:
if(tree instanceof BO3)
{
if(((BO3) tree).spawn(world, random, spawnX, spawnZ))
{
// Success!
return true;
}
}
else
{
if (tree.spawnForced(world, random, rotation, spawnX, y, spawnZ))
{
// Success!
return true;
}
}
How about adding spawn(world, random, spawnX, spawnZ)
to the CustomObject
interface instead? Then you don't need to cast to a BO3 first. (A better name for this method would probably be spawnInColumn
.)
Hi @hexosse can you compile the plugin for me with this feature? i have TerrainControl 2.7.2
@rutgerkok : I didn't want to change the CustomObject
interface in a first place. This would have an impact on all generated structures? I'll try and propose a new commit to this PR.
@agusztin : which version of bukkit is 2.7.2
It will not affect other structures if the code in the new spawn method is equivalent to the old code that was outside the method. It requires some care, but it results in much cleaner code.
If you're having trouble, just leave a message here, and I'll see what I can do.
@hexosse Server version: This server is running CraftBukkit version git-Spigot-21fe707-e1ebe52 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT) TerrainControl Version: 2.7.2
I don't find a good way to do it.
In fact, I don't understand few parts of the code yet.
The process function could be used for it, but it use frequency
and rarity
which should be ignored for Tree(..), Sapling(..) and CustomStructure(..)
I don't think that adding a new function is a good point as there is already many spawn functions (spawn, spawnInChunk, process)