-
-
Notifications
You must be signed in to change notification settings - Fork 446
TreeTypes makeover #8639
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
Closed
Closed
TreeTypes makeover #8639
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cbbb71c
Modernize rgb() function with DefaultFunction usage, range checks (#8…
Dev-Xeiji 54fb6c6
Clean up some docs mistakes in loot tables (#8596)
sovdeeth 6dd84a3
Remove mentions of SQL variable storage from config.sk (#8598)
sovdeeth b3dbaf0
TreeTypes makeover
ShaneBeee a4a9942
SkriptClasses - remove defaultExpression (Skript didnt like this)
ShaneBeee e4de83b
default.lang - fix forgotten name change
ShaneBeee 0402e93
TreeSpecies - name changes as requested
ShaneBeee 0b8118a
Merge branch 'dev/feature' into fix/tree-type
sovdeeth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| package ch.njol.skript.util; | ||
|
|
||
| import ch.njol.util.coll.CollectionUtils; | ||
| import org.bukkit.Location; | ||
| import org.bukkit.TreeType; | ||
| import org.bukkit.World; | ||
| import org.bukkit.block.Block; | ||
|
|
||
| public enum TreeSpecies { | ||
| TREE(TreeType.values()), | ||
|
|
||
| REGULAR(TreeType.TREE, TreeType.BIG_TREE), | ||
| SMALL_REGULAR(TreeType.TREE), | ||
| BIG_REGULAR(TreeType.BIG_TREE), | ||
|
|
||
| REDWOOD(TreeType.REDWOOD, TreeType.TALL_REDWOOD), | ||
| SMALL_REDWOOD(TreeType.REDWOOD), | ||
| BIG_REDWOOD(TreeType.TALL_REDWOOD), | ||
| MEGA_REDWOOD(TreeType.MEGA_REDWOOD), | ||
|
|
||
| BIRCH(TreeType.BIRCH, TreeType.TALL_BIRCH), | ||
| SMALL_BIRCH(TreeType.BIRCH), | ||
| TALL_BIRCH(TreeType.TALL_BIRCH), | ||
|
|
||
| JUNGLE(TreeType.SMALL_JUNGLE, TreeType.JUNGLE, TreeType.COCOA_TREE), | ||
| SMALL_JUNGLE(TreeType.SMALL_JUNGLE), | ||
| BIG_JUNGLE(TreeType.JUNGLE), | ||
| COCOA_TREE(TreeType.COCOA_TREE), | ||
|
|
||
| JUNGLE_BUSH(TreeType.JUNGLE_BUSH), | ||
|
|
||
| ACACIA(TreeType.ACACIA), | ||
| DARK_OAK(TreeType.DARK_OAK), | ||
| SWAMP(TreeType.SWAMP), | ||
|
|
||
| MUSHROOM(TreeType.RED_MUSHROOM, TreeType.BROWN_MUSHROOM), | ||
| RED_MUSHROOM(TreeType.RED_MUSHROOM), | ||
| BROWN_MUSHROOM(TreeType.BROWN_MUSHROOM), | ||
|
|
||
| MANGROVE(TreeType.MANGROVE, TreeType.TALL_MANGROVE), | ||
| SMALL_MANGROVE(TreeType.MANGROVE), | ||
| BIG_MANGROVE(TreeType.TALL_MANGROVE), | ||
|
|
||
| AZALEA(TreeType.AZALEA), | ||
|
|
||
| PALE_OAK(TreeType.PALE_OAK, TreeType.PALE_OAK_CREAKING), | ||
| PALE_OAK_NORMAL(TreeType.PALE_OAK), | ||
| PALE_OAK_CREAKING(TreeType.PALE_OAK_CREAKING), | ||
|
|
||
| CHERRY(TreeType.CHERRY), | ||
|
|
||
| CRIMSON_FUNGUS(TreeType.CRIMSON_FUNGUS), | ||
| WARPED_FUNGUS(TreeType.WARPED_FUNGUS), | ||
|
|
||
| CHORUS_PLANT(TreeType.CHORUS_PLANT), | ||
| ; | ||
|
|
||
| private final TreeType[] types; | ||
|
|
||
| TreeSpecies(TreeType... types) { | ||
| this.types = types; | ||
| } | ||
|
|
||
| public void grow(Location location) { | ||
| TreeType tree = CollectionUtils.getRandom(types); | ||
| assert tree != null; // No enum member causes empty types | ||
| World world = location.getWorld(); | ||
| if (world == null) { | ||
| return; | ||
| } | ||
| world.generateTree(location, tree); | ||
| } | ||
|
|
||
| public void grow(Block block) { | ||
| grow(block.getLocation()); | ||
| } | ||
|
|
||
| public TreeType[] getTypes() { | ||
| return types; | ||
| } | ||
|
|
||
| public boolean is(TreeType type) { | ||
| return CollectionUtils.contains(types, type); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.