2015-11-02 19:57:48 -08:00
|
|
|
package WayofTime.bloodmagic.item.sigil;
|
|
|
|
|
2016-03-27 16:53:08 -04:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2015-11-02 19:57:48 -08:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-03-27 16:53:08 -04:00
|
|
|
import net.minecraft.init.MobEffects;
|
2016-03-18 14:54:31 -04:00
|
|
|
import net.minecraft.init.SoundEvents;
|
2015-11-02 19:57:48 -08:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-03-27 16:53:08 -04:00
|
|
|
import net.minecraft.potion.PotionEffect;
|
2016-03-18 14:54:31 -04:00
|
|
|
import net.minecraft.util.ActionResult;
|
|
|
|
import net.minecraft.util.EnumHand;
|
|
|
|
import net.minecraft.util.SoundCategory;
|
|
|
|
import net.minecraft.util.math.Vec3d;
|
2015-11-02 19:57:48 -08:00
|
|
|
import net.minecraft.world.World;
|
2016-03-18 14:54:31 -04:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-03-27 16:53:08 -04:00
|
|
|
import WayofTime.bloodmagic.api.iface.ISentientSwordEffectProvider;
|
|
|
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
|
|
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
2015-11-02 19:57:48 -08:00
|
|
|
|
2016-03-27 16:53:08 -04:00
|
|
|
public class ItemSigilAir extends ItemSigilBase implements ISentientSwordEffectProvider
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
|
|
|
public ItemSigilAir()
|
|
|
|
{
|
2015-11-02 19:57:48 -08:00
|
|
|
super("air", 50);
|
2016-01-18 22:34:12 -08:00
|
|
|
setRegistryName(Constants.BloodMagicItem.SIGIL_AIR.getRegName());
|
2015-11-02 19:57:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-18 14:54:31 -04:00
|
|
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
2015-12-30 15:34:40 -05:00
|
|
|
{
|
|
|
|
if (!world.isRemote && !isUnusable(stack))
|
|
|
|
{
|
2016-03-18 14:54:31 -04:00
|
|
|
Vec3d vec = player.getLookVec();
|
2015-11-02 19:57:48 -08:00
|
|
|
double wantedVelocity = 1.7;
|
|
|
|
|
|
|
|
// TODO - Revisit after potions
|
2015-12-30 15:34:40 -05:00
|
|
|
// if (player.isPotionActive(ModPotions.customPotionBoost)) {
|
|
|
|
// int amplifier =
|
|
|
|
// player.getActivePotionEffect(ModPotions.customPotionBoost).getAmplifier();
|
|
|
|
// wantedVelocity += (1 + amplifier) * (0.35);
|
|
|
|
// }
|
2015-11-02 19:57:48 -08:00
|
|
|
|
|
|
|
player.motionX = vec.xCoord * wantedVelocity;
|
|
|
|
player.motionY = vec.yCoord * wantedVelocity;
|
|
|
|
player.motionZ = vec.zCoord * wantedVelocity;
|
|
|
|
player.velocityChanged = true;
|
2016-03-22 21:10:05 -04:00
|
|
|
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
2016-03-18 14:54:31 -04:00
|
|
|
|
2015-11-02 19:57:48 -08:00
|
|
|
player.fallDistance = 0;
|
|
|
|
|
|
|
|
if (!player.capabilities.isCreativeMode)
|
2016-03-22 21:10:05 -04:00
|
|
|
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()));
|
2015-11-02 19:57:48 -08:00
|
|
|
}
|
|
|
|
|
2016-03-18 14:54:31 -04:00
|
|
|
return super.onItemRightClick(stack, world, player, hand);
|
2015-11-02 19:57:48 -08:00
|
|
|
}
|
2016-03-27 16:53:08 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean applyOnHitEffect(EnumDemonWillType type, ItemStack swordStack, ItemStack providerStack, EntityLivingBase attacker, EntityLivingBase target)
|
|
|
|
{
|
|
|
|
target.addPotionEffect(new PotionEffect(MobEffects.levitation, 200, 0));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean providesEffectForWill(EnumDemonWillType type)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-11-02 19:57:48 -08:00
|
|
|
}
|