This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
SorceryCraft/src/main/java/com/thebrokenrail/sorcerycraft/spell/api/Spell.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 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
}
/**
* 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
}
/**
* 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 ExampleSpell 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 Max Level
*/
public abstract int getMaxLevel();
}