69 lines
1.7 KiB
Java
69 lines
1.7 KiB
Java
package com.thebrokenrail.sorcerycraft.spell.api;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.Identifier;
|
|
import net.minecraft.util.hit.BlockHitResult;
|
|
import net.minecraft.world.World;
|
|
|
|
public abstract class Spell {
|
|
private final Identifier id;
|
|
private final int level;
|
|
|
|
public Spell(Identifier id, int level) {
|
|
this.id = id;
|
|
this.level = level;
|
|
}
|
|
|
|
/**
|
|
* @return The ID of this Spell
|
|
*/
|
|
public Identifier getID() {
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* @return The level of this Spell
|
|
*/
|
|
public int getLevel() {
|
|
return level;
|
|
}
|
|
|
|
/**
|
|
* Execute this Spell on an Entity
|
|
* @param world World
|
|
* @param source A SpellEntity
|
|
* @param attacker The Entity that cast this Spell
|
|
* @param target The Target
|
|
*/
|
|
public void execute(World world, Entity source, Entity attacker, Entity target) {
|
|
// NOOP
|
|
}
|
|
|
|
/**
|
|
* Cast this Spell on a block
|
|
* @param world World
|
|
* @param source A SpellEntity
|
|
* @param attacker The Entity that cast this Spell
|
|
* @param hitResult The block's HitResult
|
|
*/
|
|
public void execute(World world, Entity source, Entity attacker, BlockHitResult hitResult) {
|
|
// NOOP
|
|
}
|
|
|
|
/**
|
|
* @return The amount of levels required to make this Spell in a Casting Table
|
|
*/
|
|
public abstract int getXPCost();
|
|
|
|
/**
|
|
* @return The item(s) required to make ExampleSpell in a Casting Table, or ItemStack.EMPTY if an item is not required
|
|
*/
|
|
public abstract ItemStack getItemCost();
|
|
|
|
/**
|
|
* @return The maximum level of this Spell
|
|
*/
|
|
public abstract int getMaxLevel();
|
|
}
|