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/LevitateSpell.java
TheBrokenRail 28fa7115c6
All checks were successful
SorceryCraft/pipeline/head This commit looks good
1.0.3
Tweak Loot Tables
Fix Dispenser Bugs
Fix Inward Bugs
2020-03-03 18:08:22 -05:00

54 lines
1.3 KiB
Java

package com.thebrokenrail.sorcerycraft.spell;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
public class LevitateSpell extends Spell {
public LevitateSpell(Identifier id, int level) {
super(id, level);
}
@Override
public void execute(Entity target, Entity source, Entity attacker) {
if (target instanceof LivingEntity) {
((LivingEntity) target).addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 400 + (getLevel() * 160)));
}
}
@Override
public int getXPCost() {
switch (getLevel()) {
case 0: {
return 12;
}
case 1: {
return 21;
}
}
return -1;
}
@Override
public ItemStack getItemCost() {
switch (getLevel()) {
case 0: {
return new ItemStack(Items.SHULKER_SHELL);
}
case 1: {
return new ItemStack(Items.SHULKER_SHELL, 4);
}
}
return ItemStack.EMPTY;
}
@Override
public int getMaxLevel() {
return 2;
}
}