74 lines
1.8 KiB
Java
74 lines
1.8 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;
|
|
}
|
|
|
|
/**
|
|
* Get the ID of this spell
|
|
* @return The Spell ID
|
|
*/
|
|
public Identifier getID() {
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* Get the level of this spell
|
|
* @return The Spell's Level
|
|
*/
|
|
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
|
|
}
|
|
|
|
/**
|
|
* Execute 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
|
|
}
|
|
|
|
/**
|
|
* Get the amount of levels required to make this spell in a Casting Table
|
|
* @return The XP cost
|
|
*/
|
|
public abstract int getXPCost();
|
|
|
|
/**
|
|
* Get the item(s) required to make this spell in a Casting Table, or ItemStack.EMPTY if an item is not required
|
|
* @return The item cost
|
|
*/
|
|
public abstract ItemStack getItemCost();
|
|
|
|
/**
|
|
* Get the maximum level of this spell
|
|
* @return The Spell's Max Level
|
|
*/
|
|
public abstract int getMaxLevel();
|
|
}
|