2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia.magic;
|
2018-09-12 01:29:49 +02:00
|
|
|
|
2020-04-15 14:22:03 +02:00
|
|
|
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
2020-04-15 18:12:00 +02:00
|
|
|
import com.minelittlepony.unicopia.util.NbtSerialisable;
|
2020-01-27 17:37:22 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
2019-01-22 17:39:30 +01:00
|
|
|
/**
|
|
|
|
* Gets the name used to identify this effect.
|
|
|
|
*/
|
2019-02-08 22:39:02 +01:00
|
|
|
String getName();
|
2018-09-12 01:29:49 +02:00
|
|
|
|
2019-02-08 22:39:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the tint for this spell when applied to a gem.
|
|
|
|
*/
|
|
|
|
int getTint();
|
2019-01-22 17:39:30 +01:00
|
|
|
|
2019-02-08 22:39:02 +01:00
|
|
|
/**
|
|
|
|
* Sets this effect as dead.
|
|
|
|
*/
|
|
|
|
void setDead();
|
2018-09-12 01:29:49 +02:00
|
|
|
|
2019-02-08 22:39:02 +01: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
|
|
|
|
2019-02-05 21:47:18 +01: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);
|
|
|
|
|
2019-02-08 22:39:02 +01:00
|
|
|
/**
|
|
|
|
* Returns true if this effect can be crafted into a gem.
|
|
|
|
*/
|
|
|
|
boolean isCraftable();
|
2019-02-04 19:29:37 +01:00
|
|
|
|
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
|
|
|
|
2019-02-08 22:39:02 +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-02-08 22:39:02 +01:00
|
|
|
}
|
2019-01-26 22:20:35 +01:00
|
|
|
|
2020-01-27 17:37:22 +01:00
|
|
|
default boolean handleProjectileImpact(ProjectileEntity projectile) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-02-08 22:39:02 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
2019-02-08 22:39:02 +01: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);
|
2019-02-08 22:39:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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() {
|
2019-02-08 22:39:02 +01:00
|
|
|
return SpellRegistry.instance().copyInstance(this);
|
|
|
|
}
|
2018-09-12 01:29:49 +02:00
|
|
|
}
|