BloodMagic/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilAir.java

51 lines
1.8 KiB
Java
Raw Normal View History

2015-11-02 19:57:48 -08:00
package WayofTime.bloodmagic.item.sigil;
import net.minecraft.entity.player.EntityPlayer;
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-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;
2015-11-02 19:57:48 -08:00
public class ItemSigilAir extends ItemSigilBase
{
public ItemSigilAir()
{
2015-11-02 19:57:48 -08:00
super("air", 50);
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)
{
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
// 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-18 14:54:31 -04:00
world.playSound((EntityPlayer) 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);
2015-11-02 19:57:48 -08:00
player.fallDistance = 0;
if (!player.capabilities.isCreativeMode)
2015-12-30 17:24:40 -05:00
this.setUnusable(stack, !syphonNetwork(stack, 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
}
}