2020-04-27 18:30:44 +02:00
|
|
|
package de.ellpeck.naturesaura.items;
|
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|
|
|
import de.ellpeck.naturesaura.entities.EntityLightProjectile;
|
|
|
|
import de.ellpeck.naturesaura.entities.ModEntities;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.ActionResult;
|
|
|
|
import net.minecraft.util.ActionResultType;
|
|
|
|
import net.minecraft.util.Hand;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class ItemLightStaff extends ItemImpl {
|
|
|
|
public ItemLightStaff() {
|
|
|
|
super("light_staff");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
|
|
|
ItemStack stack = playerIn.getHeldItem(handIn);
|
|
|
|
if (!worldIn.isRemote && NaturesAuraAPI.instance().extractAuraFromPlayer(playerIn, 1000, false)) {
|
|
|
|
EntityLightProjectile projectile = new EntityLightProjectile(ModEntities.LIGHT_PROJECTILE, playerIn, worldIn);
|
2020-09-22 03:17:02 +02:00
|
|
|
projectile.func_234612_a_(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0, 1.5F, 0);
|
2020-04-27 18:30:44 +02:00
|
|
|
worldIn.addEntity(projectile);
|
|
|
|
}
|
|
|
|
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
|
|
|
}
|
|
|
|
}
|