Class MinionSpell<T extends net.minecraft.world.entity.Mob>
java.lang.Object
com.binaris.wizardry.api.content.spell.Spell
com.binaris.wizardry.content.spell.abstr.MinionSpell<T>
- Type Parameters:
T- The type of mob that is summoned by this spell.
- Direct Known Subclasses:
SummonIceGiant,SummonSkeleton,SummonSkeletonLegion,SummonWitherSkeleton,SummonZombie
Base class for spells that summon minions. Handles the common functionality such as spawning the minions, setting
their lifetime and applying modifiers. The actual type of minion is specified by a factory function passed to the
constructor.
Minions are spawned on the ground near the caster by default, but this can be changed to midair by calling
flying(boolean) with true as the argument. In this case, if no suitable ground position can be found within
the summon radius, they will be spawned at y=2 at a random horizontal position within the summon radius instead.
The process of creating the minion data and overwriting the original entity logic is handled by the MinionData
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the minions are spawned in midair.static final StringAttribute Modifier idA factory that creates the minions.static final StringAttribute Modifier idprotected booleanWhen the created minion should follow the ownerFields inherited from class com.binaris.wizardry.api.content.spell.Spell
pitch, pitchVariation, volume -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddMinionExtras(T minion, CastContext ctx, int alreadySpawned) booleanbooleanbooleancast(EntityCastContext ctx) booleancast(LocationCastContext ctx) booleancast(PlayerCastContext ctx) protected TcreateMinion(net.minecraft.world.level.Level world, @Nullable net.minecraft.world.entity.LivingEntity caster, SpellModifiers modifiers) protected booleanextraConditions(CastContext ctx, net.minecraft.core.BlockPos containing) flying(boolean flying) Sets whether the minions are spawned in midair.protected @NotNull SpellPropertiesbooleanWhether this spell requires a packet to be sent when it is cast.setShouldFollowOwner(boolean shouldFollowOwner) protected booleanspawnMinions(CastContext ctx) Methods inherited from class com.binaris.wizardry.api.content.spell.Spell
assignProperties, endCast, getAction, getCharge, getCooldown, getCost, getDesc, getDescriptionFormatted, getDescriptionId, getElement, getIcon, getLocation, getLoopSounds, getOrCreateDescriptionId, getOrCreateLocation, getPitch, getPitchVariation, getProperties, getTier, getType, getVolume, hasEnded, is, is, is, isEmpty, isEnabled, isInstantCast, onCharge, playSound, playSound, playSound, playSoundLoop, playSoundLoop, property, setProperties, soundValues, toString
-
Field Details
-
HEALTH_MODIFIER
Attribute Modifier id- See Also:
-
POTENCY_ATTRIBUTE_MODIFIER
Attribute Modifier id- See Also:
-
minionFactory
protected final Function<net.minecraft.world.level.Level,T extends net.minecraft.world.entity.Mob> minionFactoryA factory that creates the minions. -
flying
protected boolean flyingWhether the minions are spawned in midair. Defaults to false. -
shouldFollowOwner
protected boolean shouldFollowOwnerWhen the created minion should follow the owner
-
-
Constructor Details
-
MinionSpell
-
-
Method Details
-
setShouldFollowOwner
-
flying
Sets whether the minions are spawned in midair.- Parameters:
flying- True to spawn the minions in midair, false to spawn them on the ground.- Returns:
- The spell instance, allowing this method to be chained onto the constructor.
-
canCastByLocation
public boolean canCastByLocation()- Overrides:
canCastByLocationin classSpell
-
canCastByEntity
public boolean canCastByEntity()- Overrides:
canCastByEntityin classSpell
-
cast
-
cast
-
cast
-
spawnMinions
-
createMinion
protected T createMinion(net.minecraft.world.level.Level world, @Nullable @Nullable net.minecraft.world.entity.LivingEntity caster, SpellModifiers modifiers) -
addMinionExtras
-
extraConditions
-
requiresPacket
public boolean requiresPacket()Description copied from class:SpellWhether this spell requires a packet to be sent 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). This is not checked for continuous spells, because they never need to send packets.If in doubt, leave this method as is; it is purely an optimisation.
- 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.
-
properties
- Specified by:
propertiesin classSpell
-