package com.thebrokenrail.sorcerycraft.spell;
import com.thebrokenrail.sorcerycraft.spell.api.Spell;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class CoolingSpell extends Spell {
public CoolingSpell(Identifier id, int level) {
super(id, level);
}
@Override
public void execute(World world, Entity source, Entity attacker, Entity target) {
target.setFireTicks(0);
public void execute(World world, Entity source, Entity attacker, BlockHitResult hitResult) {
BlockPos blockPos = hitResult.getBlockPos();
if (world.getBlockState(blockPos).matches(BlockTags.FIRE)) {
world.removeBlock(blockPos, false);
BlockPos sideBlockPos = blockPos.offset(hitResult.getSide());
if (world.getBlockState(sideBlockPos).matches(BlockTags.FIRE)) {
world.removeBlock(sideBlockPos, false);
public int getXPCost() {
return 10;
public ItemStack getItemCost() {
return new ItemStack(Items.ICE);
public int getMaxLevel() {
return 1;