-
-
Notifications
You must be signed in to change notification settings - Fork 446
TreeType Makeover #8640
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
Open
ShaneBeee
wants to merge
10
commits into
SkriptLang:dev/feature
Choose a base branch
from
ShaneBeee:fix/tree-type-part-2
base: dev/feature
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
TreeType Makeover #8640
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b8d561c
TreeTypes makeover
ShaneBeee 68b9d32
SkriptClasses - remove defaultExpression (Skript didnt like this)
ShaneBeee 2480ad7
default.lang - fix forgotten name change
ShaneBeee f9ba171
TreeSpecies - name changes as requested
ShaneBeee cd4af07
SkriptClasses - add assumed since (based on EffTree)
ShaneBeee e28a819
Merge branch 'dev/feature' into fix/tree-type-part-2
Efnilite 9af4fcd
TreeSpecies - add javadocs
ShaneBeee 61eae12
EffTree.sk - add test
ShaneBeee a7ff801
EffTree.sk - shrink radius
ShaneBeee 0ac003b
Update src/test/skript/tests/syntaxes/effects/EffTree.sk
ShaneBeee 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 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,116 @@ | ||
| 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; | ||
|
|
||
| /** | ||
| * Repesents a grouping of Bukkkit {@link TreeType TreeTypes} | ||
| */ | ||
| public enum TreeSpecies { | ||
| TREE(TreeType.values()), | ||
|
|
||
| OAK(TreeType.TREE, TreeType.BIG_TREE), | ||
| SMALL_OAK(TreeType.TREE), | ||
| BIG_OAK(TreeType.BIG_TREE), | ||
|
|
||
| SPRUCE(TreeType.REDWOOD, TreeType.TALL_REDWOOD), | ||
| SMALL_SPRUCE(TreeType.REDWOOD), | ||
| BIG_SPRUCE(TreeType.TALL_REDWOOD), | ||
| MEGA_SPRUCE(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; | ||
| } | ||
|
|
||
| /** | ||
| * Grow a tree at a location. | ||
| * <p> | ||
| * If the species is a group, a random tree type is selected. | ||
| * </p> | ||
| * | ||
| * @param location Location to grow the tree at | ||
| */ | ||
| 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); | ||
| } | ||
|
|
||
| /** | ||
| * Grow a tree at a location. | ||
| * <p> | ||
| * If the species is a group, a random tree type is selected. | ||
| * </p> | ||
| * | ||
| * @param block Block to grow the tree at | ||
| */ | ||
| public void grow(Block block) { | ||
| grow(block.getLocation()); | ||
| } | ||
|
|
||
| /** | ||
| * Get the TreeTypes that make up this species. | ||
| * | ||
| * @return TreeTypes that make up this species | ||
| */ | ||
| public TreeType[] getTypes() { | ||
| return types; | ||
| } | ||
|
|
||
| /** | ||
| * Check if this species contains a specific tree type. | ||
| * | ||
| * @param type TreeType to check for | ||
| * @return True if the species contains the type, false otherwise | ||
| */ | ||
| public boolean is(TreeType type) { | ||
| return CollectionUtils.contains(types, type); | ||
| } | ||
|
|
||
| } | ||
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.