Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable BO3 trees to be generated at different heights #530

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Enable BO3 trees to be generated at different heights #530

wants to merge 4 commits into from

Conversation

hexosse
Copy link

@hexosse hexosse commented May 31, 2017

This enable to generate trees at different heights when SpawnHeightOffset and SpawnHeightVariance in BO3.

@rutgerkok
Copy link
Contributor

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.)

@agusztin
Copy link

agusztin commented Jun 4, 2017

Hi @hexosse can you compile the plugin for me with this feature? i have TerrainControl 2.7.2

@hexosse
Copy link
Author

hexosse commented Jun 6, 2017

@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

@rutgerkok
Copy link
Contributor

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.

@agusztin
Copy link

agusztin commented Jun 6, 2017

@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

@hexosse
Copy link
Author

hexosse commented Jun 7, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants