コード例 #1
0
 @Override
 public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
   if (ArcanaHelper.getProperties(player).useBar(12)) {
     Sounds.playSound(player, player.worldObj, Sounds.arcaniumSaber);
     return false;
   }
   return true;
 }
コード例 #2
0
 @Override
 public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int par4) {
   if (stack.getItem() == ArcanaItems.meriksMissile) {
     int var6 = this.getMaxItemUseDuration(stack) - par4;
     boolean var5 =
         player.capabilities.isCreativeMode
             || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
     if (ArcanaHelper.getProperties(player).useBar(arcana)) {
       float var7 = (float) var6 / 20.0F;
       var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;
       if ((double) var7 < 0.1D) return;
       if (var7 > 1.0F) var7 = 1.0F;
       EntityMerikMissile var8 = new EntityMerikMissile(world, player);
       world.playSoundAtEntity(
           player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F);
       if (!world.isRemote) world.spawnEntityInWorld(var8);
     }
   }
 }