Unicopia/src/main/java/com/minelittlepony/unicopia/magic/MagicEffect.java

102 lines
2.3 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia.magic;
2018-09-12 01:29:49 +02:00
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
2020-04-15 18:12:00 +02:00
import com.minelittlepony.unicopia.util.NbtSerialisable;
import net.minecraft.entity.projectile.ProjectileEntity;
2018-09-12 01:29:49 +02:00
/**
2018-09-24 21:37:16 +02:00
* Interface for a magic spells
2018-09-12 01:29:49 +02:00
*/
2020-04-15 18:12:00 +02:00
public interface MagicEffect extends NbtSerialisable, Affine {
2018-09-12 01:29:49 +02:00
/**
* Gets the name used to identify this effect.
*/
String getName();
2018-09-12 01:29:49 +02:00
/**
* Gets the tint for this spell when applied to a gem.
*/
int getTint();
/**
* Sets this effect as dead.
*/
void setDead();
2018-09-12 01:29:49 +02:00
/**
* Returns true if this spell is dead, and must be cleaned up.
*/
2020-01-17 14:27:26 +01:00
boolean isDead();
2018-09-12 01:29:49 +02:00
/**
* Returns true if this effect has changes that need to be sent to the client.
*/
boolean isDirty();
/**
* Marks this effect as dirty.
*/
void setDirty(boolean dirty);
/**
* Returns true if this effect can be crafted into a gem.
*/
boolean isCraftable();
2019-02-06 09:31:31 +01:00
/**
* Gets the highest level this spell can be safely operated at.
* Gems may go higher, however chance of explosion/exhaustion increases with every level.
*/
2020-04-15 18:12:00 +02:00
int getMaxLevelCutOff(Caster<?> caster);
2019-02-06 09:31:31 +01:00
2020-04-15 18:12:00 +02:00
float getMaxExhaustion(Caster<?> caster);
2019-02-06 09:31:31 +01:00
/**
* Gets the chances of this effect turning into an innert gem or exploding.
*/
2020-04-15 18:12:00 +02:00
float getExhaustion(Caster<?> caster);
2019-02-06 09:31:31 +01:00
/**
* Called when first attached to a gem.
*/
2020-04-15 18:12:00 +02:00
default void onPlaced(Caster<?> caster) {
2019-01-26 22:20:35 +01:00
}
2019-01-26 22:20:35 +01:00
default boolean handleProjectileImpact(ProjectileEntity projectile) {
return false;
}
/**
* Called every tick when attached to an entity.
* Called on both sides.
*
* @param source The entity we are currently attached to.
*/
2020-04-15 18:12:00 +02:00
boolean update(Caster<?> source);
2018-09-12 01:29:49 +02:00
/**
* Called every tick when attached to an entity to produce particle effects.
* Is only called on the client side.
*
* @param source The entity we are attached to.
*/
2020-04-15 18:12:00 +02:00
void render(Caster<?> source);
/**
* Return true to allow the gem update and move.
*/
default boolean allowAI() {
return false;
}
2019-02-09 13:26:03 +01:00
/**
* Returns a new, deep-copied instance of this spell.
*/
2020-04-15 18:12:00 +02:00
default MagicEffect copy() {
return SpellRegistry.instance().copyInstance(this);
}
2018-09-12 01:29:49 +02:00
}