-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
playeffect - support new data types #2678
Open
Hydroxycobalamin
wants to merge
11
commits into
DenizenScript:dev
Choose a base branch
from
Hydroxycobalamin:playeffect-additions
base: dev
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
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fbbd625
Float, Integer, Color, TargetColor playeffect additions
Hydroxycobalamin ffc45fb
update meta
Hydroxycobalamin 916e4b1
fix format
Hydroxycobalamin 42202a8
1.21.4 changes
Hydroxycobalamin bdf6925
Merge remote-tracking branch 'upstream/dev' into playeffect-additions
Hydroxycobalamin 9a61c64
playeffect cmd part 1
Hydroxycobalamin 151c7f1
playeffect cmd part 2
Hydroxycobalamin 2446ee6
make also a part 3
Hydroxycobalamin e072dfb
this is the final part
Hydroxycobalamin cee463a
Merge remote-tracking branch 'upstream/dev' into playeffect-additions
Hydroxycobalamin 5456b24
turn special_data into a map
Hydroxycobalamin 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 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 |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
import com.denizenscript.denizencore.scripts.commands.AbstractCommand; | ||
import com.denizenscript.denizencore.utilities.CoreUtilities; | ||
import com.denizenscript.denizencore.utilities.debugging.Debug; | ||
import org.bukkit.Color; | ||
import org.bukkit.Effect; | ||
import org.bukkit.Particle; | ||
import org.bukkit.Vibration; | ||
|
@@ -86,6 +87,10 @@ public PlayEffectCommand() { | |
// - For BLOCK_MARKER, FALLING_DUST, BLOCK_CRACK, or BLOCK_DUST particles, the input is any valid MaterialTag, eg "stone". | ||
// - For VIBRATION, the input is <duration>|<origin>|<destination> where origin is a LocationTag and destination is either LocationTag or EntityTag, for example "5s|<context.location>|<player>" | ||
// - For ITEM_CRACK particles, the input is any valid ItemTag, eg "stick". | ||
// - For TARGET_COLOR, the input is of format: <color>|<location>, for example "red|<player.cursor_on>". Color input is any valid ColorTag object. | ||
// - For COLOR, the input is any valid ColorTag. | ||
// - For FLOAT, the input is any valid ElementTag(Decimal). | ||
// - For INTEGER, the input is any valid ElementTag(Integer). | ||
// | ||
// Optionally specify a velocity vector for standard particles to move. Note that this ignores the 'data' input if used. | ||
// | ||
|
@@ -104,6 +109,24 @@ public PlayEffectCommand() { | |
// @Usage | ||
// Use to play some effects at spawn. | ||
// - playeffect effect:FIREWORKS_SPARK at:<world[world].spawn_location> visibility:100 quantity:375 data:0 offset:50.0 | ||
// | ||
// @Usage | ||
// Use to spawn a cloud of rainbow-colored ENTITY_EFFECT particles around yourself. | ||
// - foreach <util.color_names> as:color: | ||
// - playeffect effect:ENTITY_EFFECT at:<player.eye_location> quantity:25 special_data:<[color]> | ||
// | ||
// @Usage | ||
// Use to shoot a laser in to the direction you're looking at. | ||
// - playeffect effect:TRAIL at:<player.eye_location> quantity:100 offset:0 special_data:RED|<player.eye_location.ray_trace[default=air]> | ||
// | ||
// @Usage | ||
// Use to spawn a SCULK_CHARGE effect upside down. | ||
// - playeffect effect:SCULK_CHARGE at:<player.eye_location.add[0,1,0]> quantity:1 offset:0 special_data:<element[180].to_radians> | ||
// | ||
// @Usage | ||
// Use to play a SHRIEK effect with a 5-second delay. | ||
// - playeffect effect:SHRIEK at:<player.eye_location.add[0,1,0]> quantity:1 special_data:100 | ||
// | ||
// --> | ||
|
||
@Override | ||
|
@@ -345,6 +368,27 @@ else if (clazz == Vibration.class) { | |
dataObject = new Vibration(origin, destObj, duration.getTicksAsInt()); | ||
} | ||
} | ||
else if (clazz == Particle.TargetColor.class) { | ||
ListTag dataList = ListTag.valueOf(special_data.asString(), scriptEntry.getContext()); | ||
if (dataList.size() != 2) { | ||
Debug.echoError("TargetColor special_data must have 2 list entries for particle: " + particleEffect.name()); | ||
return; | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format |
||
ColorTag color = dataList.getObject(0).asType(ColorTag.class, scriptEntry.context); | ||
LocationTag target = dataList.getObject(1).asType(LocationTag.class, scriptEntry.context); | ||
dataObject = new Particle.TargetColor(target, BukkitColorExtensions.getColor(color)); | ||
} | ||
} | ||
else if (clazz == Color.class) { | ||
ColorTag color = ColorTag.valueOf(special_data.asString(), scriptEntry.context); | ||
dataObject = BukkitColorExtensions.getColor(color); | ||
} | ||
else if (clazz == Integer.class) { | ||
dataObject = special_data.asInt(); | ||
} | ||
else if (clazz == Float.class) { | ||
dataObject = special_data.asFloat(); | ||
} | ||
else { | ||
Debug.echoError("Unknown particle data type: " + clazz.getCanonicalName() + " for particle: " + particleEffect.name()); | ||
return; | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be
(Number)
but also just sayany valid number
, don't be overly technical when you don't need to beAlso what the heck is an integer particle? That
For x y z particles,
half should name particles that use a format, not the format's java class name