Class SpeedTime
java.lang.Object
com.binaris.wizardry.api.content.spell.Spell
com.binaris.wizardry.content.spell.sorcery.SpeedTime
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpellProperty<Integer>static final SpellProperty<Float>Fields inherited from class com.binaris.wizardry.api.content.spell.Spell
pitch, pitchVariation, volume -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancast(PlayerCastContext ctx) This cast method is meant to be used for spells that are cast by a player source.booleanWhether this spell is instant or not.protected voidplaySound(net.minecraft.world.level.Level world, double x, double y, double z, int ticksInUse, int duration) Plays this spell's sounds at the given position in the given world.protected voidplaySound(net.minecraft.world.level.Level world, net.minecraft.world.entity.LivingEntity entity, int castTicks, int duration) Plays this spell's sound at the given entity in the given world.protected @NotNull SpellPropertiesThis method is where you should set the default properties for your spell when creating a new spell class.booleanWhether this spell requires a packet to be sent on client when it is cast.Methods inherited from class com.binaris.wizardry.api.content.spell.Spell
assignProperties, canCastByEntity, canCastByLocation, cast, cast, endCast, equals, getAction, getChargeUp, getCooldown, getCost, getDesc, getDescriptionFormatted, getDescriptionId, getElement, getIcon, getLocation, getLoopSounds, getOrCreateDescriptionId, getOrCreateLocation, getPitch, getPitchVariation, getProperties, getTier, getType, getVolume, isEnabled, onCharge, playSound, playSoundLoop, playSoundLoop, property, soundValues, toString
-
Field Details
-
TIME_INCREMENT
-
EXTRA_TICKS
-
-
Constructor Details
-
SpeedTime
public SpeedTime()
-
-
Method Details
-
cast
Description copied from class:SpellThis cast method is meant to be used for spells that are cast by a player source. This is useful for spells that are meant to be cast by players, as it provides more information about the caster and the context of the cast.Override this method to implement the casting behavior for spells that are meant to be cast by players.
- Specified by:
castin classSpell- Parameters:
ctx- The context of the spell cast, containing information about the world, caster, hand used, modifiers, etc.- Returns:
- true if the spell was successfully cast, false otherwise. If this returns false, the spell will not be considered as having been cast, so no cooldown will be applied.
-
playSound
protected void playSound(net.minecraft.world.level.Level world, net.minecraft.world.entity.LivingEntity entity, int castTicks, int duration) Description copied from class:SpellPlays this spell's sound at the given entity in the given world. This callsSpell.playSound(Level, double, double, double, int, int), passing in the given entity's position as the xyz coordinates. Also checks if the given entity is silent, and if so, does not play the sound.You should override this is you're trying to implement a custom sound loop, check
FrostRaySpellas an example.- Overrides:
playSoundin classSpell- Parameters:
world- The world to play the sound in.entity- The entity to play the sound at, provided it is not silent.castTicks- The number of ticks this spell has already been cast for, passed in from thecast(...)methods. Not used in the base method, but included for use by subclasses overriding this method.duration- The number of ticks this spell will be cast for, passed in from thecast(...)methods. Not used in the base method, but included for use by subclasses overriding this method.
-
playSound
protected void playSound(net.minecraft.world.level.Level world, double x, double y, double z, int ticksInUse, int duration) Description copied from class:SpellPlays this spell's sounds at the given position in the given world. This is not called automatically by the Spell class; subclasses should call it at the appropriate point(s) in the cast methods. You can also override this method if you want to implement a sound loop (normally for continuous spells), checkFrostRaySpellas an example.In case you're using any standard subclass of Spell (e.g.
RaySpellArrowSpell) you won't need to handle the sound system by yourself, as these classes will call the playSound in the right moment for you.- Overrides:
playSoundin classSpell- Parameters:
world- The world to play the sound in.x- The x position to play the sound at.y- The y position to play the sound at.z- The z position to play the sound at.ticksInUse- The number of ticks this spell has already been cast for, passed in from thecast(...)methods.duration- The number of ticks this spell will be cast for, passed in from thecast(...)methods. Not used in the base method, but included for use by subclasses overriding this method.
-
requiresPacket
public boolean requiresPacket()Description copied from class:SpellWhether this spell requires a packet to be sent on client when it is cast. Returns true by default, but can be overridden to return false if the spell's cast() method does not use any code that must be executed client-side (i.e. particle spawning).If in doubt, leave this method as is; it is purely an optimization.
- Overrides:
requiresPacketin classSpell- Returns:
- true if the spell code should be run on the server and all clients in the dimension, false if the spell code should only be run on the server and the client of the player casting it.
-
isInstantCast
public boolean isInstantCast()Description copied from class:SpellWhether this spell is instant or not. An instant spell is a spell that is cast in a single tick, (it could have cooldown and/or charge-up time) and does not have a duration. By default, this returns true, as most spells are instant, but you can override this to return false if your spell is meant to have a duration and be cast over multiple ticks.- Overrides:
isInstantCastin classSpell- Returns:
- true if this spell is instant, false otherwise.
-
properties
Description copied from class:SpellThis method is where you should set the default properties for your spell when creating a new spell class. This method is called in the constructor of the Spell class, and the properties returned by this method are assigned to the spell's properties field.- Specified by:
propertiesin classSpell- Returns:
- A SpellProperties object with the default properties for your spell.
-