Class BlockToEntityTransfiguration
java.lang.Object
net.pottercraft.ollivanders2.spell.O2Spell
net.pottercraft.ollivanders2.spell.TransfigurationBase
net.pottercraft.ollivanders2.spell.BlockTransfiguration
net.pottercraft.ollivanders2.spell.BlockToEntityTransfiguration
- All Implemented Interfaces:
org.bukkit.event.Listener
- Direct Known Subclasses:
PIERTOTUM_LOCOMOTOR
public abstract class BlockToEntityTransfiguration
extends BlockTransfiguration
implements org.bukkit.event.Listener
Transform a block in to an entity.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<org.bukkit.Material, org.bukkit.entity.EntityType> If this is populated, a map of materials and what entity type to change them in to.Fields inherited from class net.pottercraft.ollivanders2.spell.BlockTransfiguration
radiusFields inherited from class net.pottercraft.ollivanders2.spell.TransfigurationBase
successRateFields inherited from class net.pottercraft.ollivanders2.spell.O2Spell
branch, cooldownMessage, defaultRadius, flavorText, isAllowedFailureMessage, location, maxProjectileDistance, maxSpellLifetime, noProjectile, player, rightWand, spellMasteryLevel, spellType, text, usesModifier, vector -
Constructor Summary
ConstructorsConstructorDescriptionBlockToEntityTransfiguration(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player player, @NotNull Double rightWand) Constructor.Default constructor for use in generating spell text. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisBlockTransfigured(@NotNull org.bukkit.block.Block block) Is this block transfigured by this spellbooleanisEntityTransfigured(@NotNull org.bukkit.entity.Entity entity) Is this entity transfigured by this spellvoidonEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) Handle when the transfigured entity is killed.protected voidTransfigure the block in to the desired entity type.Methods inherited from class net.pottercraft.ollivanders2.spell.BlockTransfiguration
revertMethods inherited from class net.pottercraft.ollivanders2.spell.TransfigurationBase
doCheckEffect, isConsumeOriginal, isPermanent, isTransfiguredMethods inherited from class net.pottercraft.ollivanders2.spell.O2Spell
checkEffect, getCloseEntities, getCoolDown, getFailureMessage, getFlavorText, getLevel, getLifeTicks, getMagicBranch, getName, getNearbyDamageableEntities, getNearbyItems, getNearbyLivingEntities, getNearbyPlayers, getSuccessMessage, getTargetBlock, getText, getWorldGuardFlags, hasHitTarget, isAtMaxDistance, isKilled, isSpellAllowed, kill, move, sendFailureMessage, sendSuccessMessage, setUsesModifier
-
Field Details
-
transfigurationMap
If this is populated, a map of materials and what entity type to change them in to.For use with spells that can do more than one type of change. Add each material that can be changed to this map. Any missing material will fall back to the default entityType.
If the spell can only target one or more specific material types and they all change to the same thing, add that to materialWhitelist and set entityType.
If the spell can target any material, make materialWhitelist blank and set entityType.
-
-
Constructor Details
-
BlockToEntityTransfiguration
Default constructor for use in generating spell text. Do not use to cast the spell.- Parameters:
plugin- the Ollivanders2 plugin
-
BlockToEntityTransfiguration
public BlockToEntityTransfiguration(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Double rightWand) Constructor.- Parameters:
plugin- a callback to the MC pluginplayer- the player who cast this spellrightWand- which wand the player was using
-
-
Method Details
-
transfigure
protected void transfigure()Transfigure the block in to the desired entity type.- Overrides:
transfigurein classBlockTransfiguration
-
isEntityTransfigured
public boolean isEntityTransfigured(@NotNull @NotNull org.bukkit.entity.Entity entity) Is this entity transfigured by this spell- Overrides:
isEntityTransfiguredin classBlockTransfiguration- Parameters:
entity- the entity to check- Returns:
- true if transfigured, false otherwise
-
isBlockTransfigured
public boolean isBlockTransfigured(@NotNull @NotNull org.bukkit.block.Block block) Is this block transfigured by this spell- Overrides:
isBlockTransfiguredin classBlockTransfiguration- Parameters:
block- the block to check- Returns:
- true if transfigured, false otherwise
-
onEntityDeath
public void onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) Handle when the transfigured entity is killed.- Parameters:
event- the entity death event
-